4

I'm having some issues with the iPhone simulators after upgrading to Lion and XCode 4.1. When I launch the simulator for 4.0, 4.1 or 4.2 (which I restored from Time Machine), I get an EXC_BAD_ACCESS error pretty much immediately on this:

0x003c23dc  <+0012>  call   0x3c23e1 <__springboard_unimplemented+17>

On 4.3, I also get an EXC_BAD_ACCESS error immediately, on objc_msgSend, and from what I can tell, it's happening before the application even launches.

I've tried cleaning the targets to no avail, and NSZombieEnabled doesn't seem to help.

The app runs perfectly on my iPhone.

EDIT: Uninstalled and reinstalled Xcode, didn't help. A blank new project runs fine. After setting some breakpoints, it looks like it's failing on this line in main.m (which isn't very helpful):

    int retVal = UIApplicationMain(argc, argv, nil, nil);

EDIT: As requested, here's the thread apply all bt full:

For the 4.2 simulator, this is repeated ~5800 times, with a different memory address each time:

#0  0x003c23dc in __springboard_unimplemented ()
No symbol table info available.

which is followed by stuff like this:

#5817 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5818 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5819 0x90bdbc0c in abort ()
No symbol table info available.
#5820 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5821 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5822 0x90bdbc0c in abort ()
No symbol table info available.
#5823 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5824 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5825 0x90bdbc0c in abort ()
No symbol table info available.
#5826 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5827 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5828 0x90bdbc0c in abort ()
No symbol table info available.
#5829 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5830 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5831 0x90bdbc0c in abort ()
No symbol table info available.
#5832 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5833 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5834 0x90bdbc0c in abort ()
No symbol table info available.
#5835 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5836 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5837 0x90bdbc0c in abort ()
No symbol table info available.
#5838 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5839 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5840 0x90bdbc0c in abort ()
No symbol table info available.
#5841 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5842 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5843 0x90bdbc0c in abort ()
No symbol table info available.
#5844 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5845 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5846 0x90bdbc0c in abort ()
No symbol table info available.
#5847 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5848 0x003ca9c1 in getrlimit$UNIX2003 ()
No symbol table info available.
#5849 0x90bf564a in sysconf ()
No symbol table info available.
#5850 0x90be62a0 in __sinit ()
No symbol table info available.
#5851 0x90bdbdee in __swsetup ()
No symbol table info available.
#5852 0x90bdc1fa in vfprintf_l ()
No symbol table info available.
#5853 0x90be620e in fprintf ()
No symbol table info available.
#5854 0x003c2543 in __springboard_unimplemented ()
No symbol table info available.
#5855 0x003cacd1 in kill$UNIX2003 ()
No symbol table info available.
#5856 0x90bdbc0c in abort ()
No symbol table info available.
#5857 0x003c2548 in __springboard_unimplemented ()
No symbol table info available.
#5858 0x003ca9c1 in getrlimit$UNIX2003 ()
No symbol table info available.
#5859 0x90bf564a in sysconf ()
No symbol table info available.
#5860 0x90be62a0 in __sinit ()
No symbol table info available.
#5861 0x90bdbdee in __swsetup ()
No symbol table info available.
#5862 0x90bdc1fa in vfprintf_l ()
No symbol table info available.
#5863 0x90be620e in fprintf ()
No symbol table info available.
#5864 0x003c2543 in __springboard_unimplemented ()
No symbol table info available.
#5865 0x003ca9c1 in getrlimit$UNIX2003 ()
No symbol table info available.
#5866 0x90bf564a in sysconf ()
No symbol table info available.
#5867 0x90be62a0 in __sinit ()
No symbol table info available.
#5868 0x90bdbdee in __swsetup ()
No symbol table info available.
#5869 0x90bdc1fa in vfprintf_l ()
No symbol table info available.
#5870 0x90be620e in fprintf ()
No symbol table info available.
#5871 0x003c2543 in __springboard_unimplemented ()
No symbol table info available.
#5872 0x003cbbe9 in mmap$UNIX2003 ()
No symbol table info available.
#5873 0x90c01319 in allocate_pages ()
No symbol table info available.
#5874 0x90c08780 in create_scalable_zone ()
No symbol table info available.
#5875 0x90c3e48d in _malloc_initialize ()
No symbol table info available.
#5876 0x90c3e86b in malloc ()
No symbol table info available.
#5877 0x99aa8a62 in get_or_create_key_element ()
No symbol table info available.
#5878 0x99aa8c6b in _keymgr_get_and_lock_processwide_ptr_2 ()
No symbol table info available.
#5879 0x99aa8e4a in __keymgr_initializer ()
No symbol table info available.
#5880 0x9bed97b8 in libSystem_initializer ()
No symbol table info available.
#5881 0x8fe9415b in __dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE ()
No symbol table info available.
#5882 0x8fe93cc0 in __dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE ()
No symbol table info available.
#5883 0x8fe91220 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
No symbol table info available.
#5884 0x8fe911b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
No symbol table info available.
#5885 0x8fe911b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
No symbol table info available.
#5886 0x8fe921c0 in __dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE ()
No symbol table info available.
#5887 0x8fe86656 in __dyld__ZN4dyld24initializeMainExecutableEv ()
No symbol table info available.
#5888 0x8fe8aef2 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
No symbol table info available.
#5889 0x8fe842ef in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKclS2_ ()
No symbol table info available.
#5890 0x8fe84063 in __dyld__dyld_start ()
No symbol table info available.

Full output here: https://gist.github.com/b14502e1c6393d655653

For the 4.3 simulator, I get this:

Thread 4 (process 1938):
#0  0x905a6c22 in mach_msg_trap ()
No symbol table info available.
#1  0x905a61f6 in mach_msg ()
No symbol table info available.
#2  0x01bcad86 in __CFRunLoopServiceMachPort ()
No symbol table info available.
#3  0x01b27e74 in __CFRunLoopRun ()
No symbol table info available.
#4  0x01b27840 in CFRunLoopRunSpecific ()
No symbol table info available.
#5  0x01b27761 in CFRunLoopRunInMode ()
No symbol table info available.
#6  0x02db5903 in RunWebThread ()
No symbol table info available.
#7  0x90be8ed9 in _pthread_start ()
No symbol table info available.
#8  0x90bec6de in thread_start ()
No symbol table info available.

Thread 3 (process 1938):
#0  0x905a990a in kevent ()
No symbol table info available.
#1  0x03f28f36 in _dispatch_mgr_invoke ()
No symbol table info available.
#2  0x03f29333 in _dispatch_queue_invoke ()
No symbol table info available.
#3  0x03f29593 in _dispatch_worker_thread2 ()
No symbol table info available.
#4  0x90beab24 in _pthread_wqthread ()
No symbol table info available.
#5  0x90bec6fe in start_wqthread ()
No symbol table info available.

Thread 2 (process 1938):
#0  0x905a902e in __workq_kernreturn ()
No symbol table info available.
#1  0x90beaccf in _pthread_wqthread ()
No symbol table info available.
#2  0x90bec6fe in start_wqthread ()
No symbol table info available.

Thread 1 (process 1938):
#0  0x01d4f09f in objc_msgSend ()
No symbol table info available.
#1  0x00000000 in ?? ()
No symbol table info available.

EDIT: Reinstalled the SDK, didn't fix anything.

EDIT: Here's the gcc command (with the app name changed)

CompileC /Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Intermediates/app.build/Debug-iphonesimulator/app.build/Objects-normal/i386/SlideshowViewController.o Classes/SlideshowViewController.m normal i386 objective-c com.apple.compilers.llvmgcc42
cd /Users/kyle/dev/app/iphone
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -x objective-c -arch i386 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -DSTAGING_API=1 -DDEBUG=1 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -fexceptions -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -fvisibility=hidden -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -iquote /Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Intermediates/app.build/Debug-iphonesimulator/app.build/app-generated-files.hmap -I/Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Intermediates/app.build/Debug-iphonesimulator/app.build/app-own-target-headers.hmap -I/Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Intermediates/app.build/Debug-iphonesimulator/app.build/app-all-target-headers.hmap -iquote /Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Intermediates/app.build/Debug-iphonesimulator/app.build/app-project-headers.hmap -I/Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Products/Debug-iphonesimulator/include -IAirship/Library -IAirship/Library/AirshipLib -IAirship/Library/InboxLib -IAirship/Library/PushLib -IAirship/Library/StoreFrontLib -IAirship/Library/SubscriptionLib -IAirship/Common -I/Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Intermediates/app.build/Debug-iphonesimulator/app.build/DerivedSources/i386 -I/Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Intermediates/app.build/Debug-iphonesimulator/app.build/DerivedSources -F/Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Products/Debug-iphonesimulator -F/Users/kyle/dev/app/iphone -include /Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/PrecompiledHeaders/app_Prefix-gbcbcigtjfyhhsbcjwzscgyfdbfj/app_Prefix.pch -c /Users/kyle/dev/app/iphone/Classes/SlideshowViewController.m -o /Users/kyle/Library/Developer/Xcode/DerivedData/app-biyijbbdlfmlcihjougudvgjsxcd/Build/Intermediates/app.build/Debug-iphonesimulator/app.build/Objects-normal/i386/SlideshowViewController.o
Kyle Slattery
  • 33,318
  • 9
  • 32
  • 36
  • I might suggest reinstalling the SDK... – Alex Nichol Jul 22 '11 at 13:52
  • when you app crashes, run t a a bt full in the debugger (thread apply all bt full) and edit your post with what you see – apouche Jul 22 '11 at 14:21
  • Ok, just added the debugger output to the question. – Kyle Slattery Jul 22 '11 at 19:01
  • Reinstall the SDK. The simulator seems to have some issues. – Sum Jul 25 '11 at 23:05
  • any chance you could post the gcc command with all args here ? – Matt Jul 31 '11 at 21:59
  • well, its a long shot, your problem clearly lies in the upgrade and stuff but thought it might be worth seeing. In xCode 4 just go to the build log tab in the navigator (on the left) and pick the most recent build, if you expand the compilation commands youll get a big gcc command. – Matt Aug 01 '11 at 09:36
  • Ok, just added the gcc command. And actually, 4.3 never worked for me, even in Snow Leopard (4.1 and 4.2 did, though). I thought I had mentioned that in the original post, but it looks like I forgot to. – Kyle Slattery Aug 01 '11 at 13:25

7 Answers7

14

Ok, so after weeks and weeks, I finally found the solution: fixing my linker flags according to this comment: EXC_BAD_ACCESS when copying or retaining Block

Essentially you change -weak_library /usr/lib/libSystem.B.dylib to -weak-lSystem.

I had originally added this because Urban Airship required it.

Community
  • 1
  • 1
Kyle Slattery
  • 33,318
  • 9
  • 32
  • 36
4

You're missing some core functionality for the simulator. Springboard is the name of the app-launcher "desktop" for iOS, and your simulator system seems to think it's unimplemented.

__springboard_unimplemented ()

This discrepency would explain why you're having trouble on the simulator, and not your phone.

I would suggest a full removal of Xcode and the iOS SDK, then reinstall fresh from the App Store.

EDIT: Some of my Googlings:

The last one was buried deep within the confines of Apple-Developer-only territory. It's a text-dump from a forum, so it's not formatted particularly well, but it looks to be the most promising. This looks like the bottom line:

Your app died because something called abort(), as shown in the Application Specific Information. The backtrace shows that abort() was called by __springboard_unimplemented(), which means you're calling a function that is present in the simulator but may not be on the device. That function is mcount_L1(). Calls to mcount_L1() come from profiling tools. To fix this, make sure you have "Generate Profile Code" unchecked in your build settings.

Patrick Perini
  • 22,555
  • 12
  • 59
  • 88
2

The answer to your problem lies in what you have written: (which I restored from Time Machine).

You are using a restored version of the Simulator that do not match your Xcode 4.1 installation.

Using any Simulator not part of the installed SDK is done at your own risk.

PeyloW
  • 36,742
  • 12
  • 80
  • 99
  • Yes, though even after deleting everything and using the 4.3 simulator that comes with 4.1, I'm still encountering the issue. – Kyle Slattery Jul 27 '11 at 18:49
1

I ran into this as well. I fixed it by removing my /Developer dir, installing Xcode 4.1, then installing Xcode 4.2, THEN installing the latest iTunes 10.5 beta. Haven't had issues since.

Amro
  • 4,683
  • 1
  • 16
  • 9
  • Did the exact same thing (with 4.1) but I had some other issues. It fixed it right up – Sum Jul 27 '11 at 02:59
  • Hm, though with 4.2 installed, I won't be able to submit apps to the App Store, since it's still in Beta. I'll try installing the iTunes beta, however. – Kyle Slattery Jul 27 '11 at 14:23
  • Ok, tried with the iTunes beta installed, still the same issue. – Kyle Slattery Jul 27 '11 at 16:04
  • You can use 4.1 to submit and install 4.2 in another directory. I have /Developer for 4.1 and /DeveloperBeta for 4.2. Reinstalling all 3 in that order worked for me. – Amro Jul 28 '11 at 14:11
1

You said you upgraded to Lion. Did you install the Lion build of Xcode or the Snow Leopard one? This looks to me like you need to install the Lion build of Xcode on Lion.

edit: The fix is in the comments, putting it here. Recreating the project file using the fresh lion installation and importing the existing source code got things going again.

slf
  • 22,595
  • 11
  • 77
  • 101
  • I downloaded it from the App Store, so I'm guessing I have the Lion build. – Kyle Slattery Aug 02 '11 at 01:45
  • did you re-download it from the app store after installing lion? – slf Aug 02 '11 at 15:32
  • Yes, I redownloaded after installing Lion. – Kyle Slattery Aug 02 '11 at 16:55
  • and when you did that reinstall, did you completely blow away the original directory, or did you reinstall on top of it? – slf Aug 02 '11 at 17:54
  • The old simulators in /Developer, but I completely removed them when reinstalling – Kyle Slattery Aug 03 '11 at 18:17
  • Try deleting the project (not the source), then creating a new project with the fresh XCode, fresh project, same source code – slf Aug 04 '11 at 01:56
  • That worked! It would be nice if I could fix the existing project, but at least I have something to compare to now. – Kyle Slattery Aug 10 '11 at 21:41
  • I remember something similar happening to me a while back when going from 2.x to 3.x, just like powerbuilder of days of yore, those files store a lot of information specific to the environment. Sometimes the code is all you really want after a major upgrade – slf Aug 11 '11 at 14:30
  • Yeah, after playing around with the project settings, I'm still having issues, so I think I'm going to have to bite the bullet and just go the new project route. It's going to wreak havoc on all my git branches though. – Kyle Slattery Aug 11 '11 at 14:51
  • *sigh* I can see that. However, you could always just make this lion / ios5 branch a new branch :) Can I have the bounty? – slf Aug 11 '11 at 15:02
  • Hm, 50 points were already assigned (since it expired), but maybe I can create another bounty for the remaining 50 and assign it to you. EDIT: Yup, looks like I can, I just need to wait a day before assigning. – Kyle Slattery Aug 11 '11 at 15:04
  • Thanks! That sure is nice of you! – slf Aug 12 '11 at 00:55
0

Firstly you can reset your simulator & quit your Xcode. After that you can delete the Application Folder in iPhone Simulator & also delete all derived data from /Library/Developer/Xcode/DerivedData. Then open your project & check whether any framework is missing or not according to your app functionality.

Gurpreet
  • 181
  • 6
-1

Kyle. I have been having a hugely similar problem. For the last few days my app crashes on the simulator but works fine on the device. I have been lazy and just testing on the device.

But when I get home tonight, I will try out some things and see if I can resolve it. For me the crash does not happen right upon launch. It happens when I type in the second character in a textField. Nothing bad happens on the first letter. Only on the second.

The crash occurs in one of two places. One is just the same as in yours - in Main. The second is in one of the textfield's callbacks. It randomly alternates. There is no stack trace in the debug window. Because I dont have the computer in front of me, I cannot remember all the details.

One thing we have in common is that I have lion. I am using xcode 4.2

Do you know if the bounty can be extended for a day or two?

look
  • 667
  • 10
  • 17
  • I'm not sure exactly how the bounty system works, it looks like I can still give it out, but I'm not sure. – Kyle Slattery Aug 02 '11 at 01:45
  • I just uninstalled my Xcode. I could not find the dmg I installed it form. So I looked in .Trash. I found that the file name there was xcode_4.2_and_ios_sdk_5_beta_2_for_snow_leopard.dmg. So I am now installing the one for Lion. – look Aug 02 '11 at 06:15
  • I see your comment to @slf. If you got it form the App Store before lion, it was probably for snow_leopard. May be there is an update... – look Aug 02 '11 at 06:49
  • Install completed. fingers crossed. – look Aug 02 '11 at 06:59
  • No luck. Same error in the same place. ==> textField.text = [textField.text stringByReplacingCharactersInRange:range withString:string]; – look Aug 02 '11 at 07:03
  • If I comment out that line, the crash happens at int retVal = UIApplicationMain(argc, argv, nil, nil); – look Aug 02 '11 at 07:09
  • I have to go back home tonight to try this... Here is what I plan to do. Obviously there is something wrong in my set up. Although an uninstall removes everything, the repository settings are still there. That impliles "everything" is not removed. Given that, I will logout, login to my son's account, install a new xcode if needed or just use the xcode there, and try it out. That is similar to using a different computer. I know this same code works fine on another computer. – look Aug 02 '11 at 18:14
  • I was able to run everything without any issues on simulator after reinstalling the non-beta version. [Here are my steps.](http://www.johnvarghese.com/reinstalling-xcode/) – look Aug 05 '11 at 06:22