iOS app crashes when first opened by URL Scheme

2019-06-28 05:29发布

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条回答
乱世女痞
2楼-- · 2019-06-28 06:06

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!

查看更多
登录 后发表回答