不后台时适用于iOS App的自定义URL方案 [英] Custom URL Scheme for iOS App when not backgrounding

查看:108
本文介绍了不后台时适用于iOS App的自定义URL方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的应用程序设置了自定义的深层链接iOS URL方案,我在

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 {

我解析URL并使用NSNotificationCenter(以URL为对象)向适当的类发送通知以处理URL.

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

当应用程序后台"运行时,这一切都很好,但是当应用程序由于多任务处理而完全关闭时,通知似乎永远不会发送(或接收).当应用程序不在后台运行时,我是否会丢失有关通知过程的信息?还有另一种方式传递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?

谢谢!

推荐答案

您应该检查传递给applicationDidFinishLuanching:withOptions:launchOptions词典.

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

有关选项字典中包含的内容的完整详细信息: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html

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

这篇关于不后台时适用于iOS App的自定义URL方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆