如何使用 UIApplication 处理 OpenURL 通知
我正在尝试处理 UIApplication 通知以在当前打开的视图中获取 URL 方案。我已经尝试了几个通知,但我不知道哪个对象包含 URL 方案。
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
//[nc addObserver:self selector:@selector(DocumentToDropboxDelegate) name:UIApplicationWillResignActiveNotification object:nil];
[nc addObserver:self selector:@selector(DocumentToDropboxDelegate) name:UIApplicationDidFinishLaunchingNotification object:nil];
有人可以帮我解决这个问题吗?
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 @Mike K 提到的,您必须实现以下方法之一(或两者):
在您的 UIApplicationDelegate 上。他们没有匹配的通知。
下面的例子:
As @Mike K mentioned you'll have to implement one (or both) of the following methods:
on your UIApplicationDelegate. There is no matching notification for them.
Example below:
application:handleOpenURL:
在您的应用程序委托上调用 - 不是通过 NSNotification。要实现的首选委托方法是:application:openURL:sourceApplication:annotation:
。更多信息可以在这里找到:
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:handleOpenURL:
application:handleOpenURL:
is called on your application delegate - not via a NSNotification. the preferred delegate method to implement is:application:openURL:sourceApplication:annotation:
.more info can be found here:
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:handleOpenURL: