Custom URL Scheme for iOS App when not backgrounding

和自甴很熟 提交于 2019-12-10 15:37:22

问题


I have set up a custom deep-linking iOS URL scheme for my app, and I listen for it in

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

I parse the URL and send a notification using NSNotificationCenter, with the URL as the object, to the appropriate class to handle the URL.

This all works great when the app is "backgrounded" but when the app is fully closed out of multitasking, it seems like the notification never gets sent (or received). Am I missing something about the process of notifications when the app isn't in backgrounding? Is there another way to pass along the information from the URL? Or is there at least a way to tell if the app is coming out of backgrounding or if it is a fresh launch?

Thanks!


回答1:


You should check the launchOptions dictionary that is passed into applicationDidFinishLuanching:withOptions:.

For full details on what is included in the options dictionary: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html



来源:https://stackoverflow.com/questions/17929759/custom-url-scheme-for-ios-app-when-not-backgrounding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!