我已经阅读了多个关于处理url方案的事情,以在我的应用程序中打开不同的视图控制器。我只是无法理解。我一直在关注Twitter https://dev.twitter.com/cards/mobile/deep-linking的教程但是已经删除了[self.viewController presentHomeScreen];因为Xcode给出了以下错误" Property' viewController'在ScanmarksAppDelegate"类型的对象上找不到。
当网址为scanmarks时,我只想打开一个名为ARViewController
的视图控制器(故事板)://当网址为scanmarks://about
时,扫描然后打开名为ScanmarksinfoTableViewController的视图控制器(故事板)
-(BOOL) application: (UIApplication * ) application openURL: (NSURL * ) url sourceApplication: (NSString * ) sourceApplication annotation: (id) annotation {
if ([url.scheme isEqualToString: @"scanmarks"]) {
// check our `host` value to see what screen to display
//TODO you can also pass parameters - e.g. birdland://home?refer=twitter
if ([url.host isEqualToString: @"scan"]) {
} else if ([url.host isEqualToString: @"about"]) {
} else {
NSLog(@"An unknown action was passed.");
}
} else {
NSLog(@"We were not opened with scanmarks.");
}
return NO;
}