iOS app crashes when first opened by URL Scheme

折月煮酒 提交于 2020-01-03 18:31:22

问题


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.

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.

Here's the crash:

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    

Any idea on how to solve this, or what am I doing wrong? I'm using iOS 8 GM and Xcode 6 GM.


回答1:


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){


                }

Thanks for the support!



来源:https://stackoverflow.com/questions/25814202/ios-app-crashes-when-first-opened-by-url-scheme

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