首次通过URL Scheme打开iOS应用程序时崩溃 [英] iOS app crashes when first opened by URL Scheme
问题描述
我的应用处理网址方案。当它已经运行并从另一个应用程序调用时,它行为正常且没有问题。但是,当它完全关闭时(如在非背景模式下),并且另一个应用程序调用它,它立即崩溃。
My app handles URL Schemes. When it is already running and gets called from another app, it behaves correctly and without a problem. However, when it is completely closed (as in not-in-background-mode), and another app calls it, it crashes immediately.
我已经设置了等待可执行文件启动选项,这样我就可以调试应用程序:willFinishLaunchingWithOptions:
但似乎它没有被调用。我还实现了 -application:openURL:sourceApplication:annotation:
但它似乎也没有被调用。
I've already set the "Wait for executable to be launched" option so I could debug the application:willFinishLaunchingWithOptions:
but it seems that it is not getting called. I've also implemented -application:openURL:sourceApplication:annotation:
but it seems that its not getting called either.
这是崩溃:
libsystem_kernel.dylib`__pthread_kill:
0x10a79e278: movl $0x2000148, %eax
0x10a79e27d: movq %rcx, %r10
0x10a79e280: syscall
0x10a79e282: jae 0x10a79e28c ; __pthread_kill + 20
0x10a79e284: movq %rax, %rdi
0x10a79e287: jmp 0x10a799ca3 ; cerror_nocancel
0x10a79e28c: retq
0x10a79e28d: nop
0x10a79e28e: nop
0x10a79e28f: nop
如何解决这个问题,或者我做错了什么?我正在使用iOS 8 GM和Xcode 6 GM。
Any idea on how to solve this, or what am I doing wrong? I'm using iOS 8 GM and Xcode 6 GM.
推荐答案
好吧,我修好了!我只需要在我的AppDelegate didFinishLaunchingWithOptions方法中检查以下情况。
Well, I fixed it! I just had to check for the following case in my AppDelegate didFinishLaunchingWithOptions method.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if ((launchOptions) != nil) {
if ((launchOptions?[UIApplicationLaunchOptionsURLKey]) != nil){
}
感谢您的支持!
这篇关于首次通过URL Scheme打开iOS应用程序时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!