Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS app crashing every other launch, can't find error

First time I launch the app, everything seems to run fine. I'll hit the stop button, do some work and when I go to launch it again, it seems to crash before it can even load anything. Press stop, hit Run again, and it works fine. Until I repeat the process.

This is where xcode is highlighting the error with "Thread 1:signal SIGABRT". Obviously nothing useful here.

int main(int argc, char *argv[]) {     @autoreleasepool {         return UIApplicationMain(argc, argv, nil, NSStringFromClass([PokerAppDelegate class]));     } } 

The debug console shows nothing besides (lldb) (So I suppose its stopping, not crashing at this point) So, when I perform a BT this is what I get:

(lldb) bt * thread #1: tid = 0x1c03, 0x9a258a6a libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT     frame #0: 0x9a258a6a libsystem_kernel.dylib`__pthread_kill + 10     frame #1: 0x99ea1b2f libsystem_c.dylib`pthread_kill + 101     frame #2: 0x04a7057b libsystem_sim_c.dylib`abort + 140     frame #3: 0x01dc0b4e GraphicsServices`GSRegisterPurpleNamedPort + 348     frame #4: 0x01dc069f GraphicsServices`_GSEventInitialize + 123     frame #5: 0x01dc0c1f GraphicsServices`GSEventInitialize + 36     frame #6: 0x000163f9 UIKit`UIApplicationMain + 600     frame #7: 0x00001d0d Guitar Chord Poker HD`main(argc=1, argv=0xbffff32c) + 141 at main.m:16     frame #8: 0x00001c35 Guitar Chord Poker HD`start + 53 (lldb)  

Here's what I have done so far:

  • Performed a 'Clean'
  • I've reset the simulators and reset my computer
  • I've commented out all the code in the view controller, still crashes
  • I've commented out all the code in the app delegate, still crashes
  • BUT....I've run the app on a device outside of Xcode, and it seems to work perfectly fine.
  • (EDIT) I've deleted/reinstalled xcode, and all content(Simulators, Docs) from the various cache folders (This stops xcode from automatically reinstalling the old ones after a new download). Still can't find where command line tools is kept though. Still crashes.

Despite all this, apps still crash every second/other launch.

Thing is I had no issues until the most recent Xcode update. Could it be an Xcode bug?

(EDIT) I am also running the latest developer releases of OSX. Could that be interfering?

like image 434
Beau Nouvelle Avatar asked Apr 19 '13 21:04

Beau Nouvelle


People also ask

Why is my app crashing right when I open it IOS?

Most often, apps crash because they aren't updated and have unaddressed bugs. To fix this, go to the Updates section of the App Store and update the app if an update is available.

Why does my app keep crashing everytime I open it?

Apps on Android can crash because of low storage space, too many apps running simultaneously, a weak internet connection, or not having the proper app updates installed.

Why is every app crashing on my iPhone?

Random and frequent app crashes in mobile devices usually denote a memory issue like when the device is running low on storage. Other performance issues including symptoms of sluggishness, unresponsiveness and random restarts are also likely to transpire in this case.

How do I find out which app is crashing on my iPhone?

Open the Console app, from Applications > Utilities in Finder. Select Crash Reports. Locate crash reports for your app in the list. Logs are listed by your app's binary name.


2 Answers

Seems to be a combination of OS X 10.8.4 and LLDB. As kenster says, switching to GDB makes the problem go away.

Edit:
It's caused by a race condition in the debug server (I hear).

Here's a fix if you want to keep using LLDB: Instead of clicking Run while the app is already running in the simulator, kill it in Xcode (⌘-.), say "I love Xcode" 5 times and Run it again (⌘-R). It won't crash, I tested it.


Fixed in Xcode 4.6.3.

like image 190
nevan king Avatar answered Sep 18 '22 16:09

nevan king


I was having this issue as well. Take a look at this post. Xcode 4.6.2 app crashes on every second run

Basically change your debugger from LLDB to GDB. I can't believe this was due to LLDB being buggy.

like image 37
kenster Avatar answered Sep 19 '22 16:09

kenster