我正在尝试处理UIApplication Notifications以在当前打开的视图中获取URL Schemes.我尝试了几个通知,但我不知道哪个对象包含URL Schemes.
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; //[nc addObserver:self selector:@selector(DocumentToDropBoxDelegate) name:UIApplicationWillResignActiveNotification object:nil]; [nc addObserver:self selector:@selector(DocumentToDropBoxDelegate) name:UIApplicationDidFinishLaunchingNotification object:nil];
有人pelase可以帮助我解决这个问题.
解决方法
正如@Mike K所提到的,你必须实现以下一种方法(或两种方法):
- application:handleOpenURL: - application:openURL:sourceApplication:annotation:
在您的UIApplicationDelegate上.没有匹配的通知.
示例如下:
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { if (url != nil && [url isFileURL]) { [self.viewController handleOpenURL:url]; } return YES; } //Deprecated -(BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url { if (url != nil && [url isFileURL]) { [self.viewController handleOpenURL:url]; } return YES; }