如何使用UIApplication handleOpenURL通知 [英] How to use UIApplication handleOpenURL Notifications
本文介绍了如何使用UIApplication handleOpenURL通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试处理UIApplication Notifications以在当前打开的视图中获取URL Schemes。我尝试了几个通知,但我不知道哪个对象包含URL Schemes。
I am trying to handle UIApplication Notifications to get URL Schemes in current open view. I have tried several notifications but i don't know which object contains the 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];
有人可以帮我解决这个问题。
Can someone pelase help me with this issue.
推荐答案
正如@Mike K所提到的,你必须实施以下一种(或两种)方法:
As @Mike K mentioned you'll have to implement one (or both) of the following methods:
- application:handleOpenURL:
- application:openURL:sourceApplication:annotation:
$ b你的UIApplicationDelegate上的$ b
。没有匹配的通知。
on your UIApplicationDelegate. There is no matching notification for them.
以下示例:
-(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;
}
这篇关于如何使用UIApplication handleOpenURL通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文