7

I'm at my wits end, I'm getting a weird crash that only happens when the app is launched from Notification Center. Either tapping on a local notification (in the notification side) or a call to extensionContext:openURL:completionHandler (from my Today widget) will launch the app with a customURL scheme.

When the app is running (warm boot), no issues, works just as advertised. When I kill the app (in task switcher) and then try to launch it through Notification Center (cold boot), I get the below crash report.

I've search low and high for anything, can't find it. This only happens on iOS8 devices, iOS7 devices has no issue (with the notification launch, obviously no Today widget)

Has anyone seen this??

thanks!

Date/Time:           2014-10-14 18:16:39.924 -0400
Launch Time:         2014-10-14 18:16:38.667 -0400
OS Version:          iOS 8.0.2 (12A405)
Report Version:      105

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000016a4cbeb8
Triggered by Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x0000000195ebbbd0 objc_msgSend + 16
1   UIKit                           0x000000018a27d840 -[UIApplication workspaceDidEndTransaction:] + 216
2   FrontBoardServices              0x000000018da7563c __31-[FBSSerialQueue performAsync:]_block_invoke + 24
3   CoreFoundation                  0x000000018582a35c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
4   CoreFoundation                  0x0000000185829464 __CFRunLoopDoBlocks + 308
5   CoreFoundation                  0x0000000185827a88 __CFRunLoopRun + 1752
6   CoreFoundation                  0x0000000185755660 CFRunLoopRunSpecific + 392
7   UIKit                           0x000000018a05f4fc -[UIApplication _run] + 548
8   UIKit                           0x000000018a05a4f4 UIApplicationMain + 1484
9   therichest                      0x00000001001caa8c main (main.m:16)
10  libdyld.dylib                   0x0000000196516a04 start + 0
Mike
  • 1,313
  • 14
  • 17
  • Did you managed to fix this @Mike? I'm seeing the same thing in a couple of apps in the wild, but can't replicate it locally by sending a push notification to the app. – siburb Oct 20 '14 at 03:01
  • I can replicate it consistently with the steps above. The other fun fact is that its iOS8 only. I'm updating to v8.1 and see if it gets resolved. – Mike Oct 20 '14 at 19:30
  • I'm hoping that it has been. I haven't seen a single instance of this happening in our apps in iOS 8.1 (yet), but it might be too early to tell conclusively. Hopefully your testing can confirm. – siburb Oct 21 '14 at 05:55
  • try pushing a notification, terminate the app. then tap you notification from Notification Centre. – Mike Oct 21 '14 at 13:02
  • I've been doing that, and haven't managed to replicate it. Will persevere. I have now had this crash in iOS8.1 though, so it is not fixed there. – siburb Oct 22 '14 at 05:30
  • i confirm this in ios 8.1 – João Nunes Feb 09 '15 at 10:47
  • I have a similar callstack on my app with ios 9.3.2 and latest facebook SDK (4.11) , did you manage to fix the issue ? – Nico AD Jun 08 '16 at 15:34

1 Answers1

7

Either your code or a third-party library you are using is manually spinning the runloop. This is causing -workspaceDidEndTransaction: to be called re-entrantly and triggers a use after free. If you set a breakpoint on -[NSRunLoop runMode:beforeDate:] and -[NSRunLoop runUntilDate:], it should hit with the guilty code being on the previous stack frame.

While manually spinning the run loop is never recommended, if you can delay doing it until your application finishes starting up (all the launch app delegate calls received) you should avoid hitting this crash.

Dex
  • 871
  • 4
  • 4
  • what @Dex mentioned is right. I was using a third party library that was manually spinning the run loop. Disabling that library fixed my problem. I've also notified the library developer since then. – Mike Feb 10 '15 at 01:38
  • @Mike Thanks. I fixed my code. I was spinning the runloop in my didLaunch app method. Removing that call fixed the crashes – João Nunes Feb 10 '15 at 15:02
  • 1
    Hey @Dex how to set breakpoint on -[NSRunLoop runMode:beforeDate:] ? Iam having the same issue, how to debug this? – Anil Varghese Sep 21 '15 at 11:05