Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 4 app crashes at startup on iOS 3.1.3: Symbol not found: __NSConcreteStackBlock

Tags:

ios

iphone

ios4

I'm running Xcode 3.2.3 with the iOS 4.0 SDK. I built my app with Base SDK = iphoneos4.0, Active SDK = iphoneos4.0, Deployment Target = 3.1.3, and Architecture = standard (arm6 arm7). Compiler = GCC 4.2. As I understand it, this is the correct way to build an app for both iOS 4 and 3.

The app runs fine on devices running iOS 4. But it crashes on startup when you try to run it on a device with iOS 3.1.3 (an iPod Touch 1G):

dyld: Symbol not found: __NSConcreteStackBlock
  Referenced from: /var/mobile/Applications/192B30ED-16AC-431E-B0E9-67C1F41FD5DA/MyApp.app/MyApp
  Expected in: /usr/lib/libSystem.B.dylib

It appears to be an issue with a fairly "low level" dynamically-linked library, BEFORE my main() function even gets called. I have even tried re-starting the device, etc., with no luck. Here's part of the the crash log:

Process:         MyApp [60]
Path:            /var/mobile/Applications/192B30ED-16AC-431E-B0E9-67C1F41FD5DA/MyApp.app/MyApp
Identifier:      MyApp
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2010-07-22 17:16:17.942 -0400
OS Version:      iPhone OS 3.1.3 (7E18)
Report Version:  104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x00000001, 0xe7ffdefe
Crashed Thread:  0

Dyld Error Message:
  Symbol not found: __NSConcreteStackBlock
  Referenced from: /var/mobile/Applications/192B30ED-16AC-431E-B0E9-67C1F41FD5DA/MyApp.app/MyApp
  Expected in: /usr/lib/libSystem.B.dylib
  Dyld Version: 149

Binary Images:
    0x1000 -    0x80fff +MyApp armv6  <d5f0ff6f233b4b034c222c16438c88d9> /var/mobile/Applications/192B30ED-16AC-431E-B0E9-67C1F41FD5DA/MyApp.app/MyApp
0x2fe00000 - 0x2fe26fff  dyld armv6  <544395a4b5546114b878d5131a84fd7f> /usr/lib/dyld
0x30410000 - 0x30536fff  libSystem.B.dylib armv6  <0373fd64e915a17160732b29d343f95f> /usr/lib/libSystem.B.dylib

Thanks for any advice!

like image 205
Clint Harris Avatar asked Jul 22 '10 21:07

Clint Harris


3 Answers

Ben Gottlieb pointed out yesterday that if you use blocks anywhere in your application, you'll see a crash similar to this on a pre-4.0 OS while building with the LLVM compiler. To work around this, you can specify the linker flag -weak-lSystem in your Xcode build settings.

like image 171
Brad Larson Avatar answered Sep 22 '22 18:09

Brad Larson


Since most of these answers are specific to Xcode 3.x, just wanted to share what I did to fix this with Xcode 4.2.

Under your target in the "Build Phases" tab in the "Link Binary With Libraries" section I added "libSystem.dylib" and made it optional. This fixed the issue iOS 3.x devices while maintaining support for iOS 4.x and 5.0 devices.

like image 24
Brandon Avatar answered Sep 22 '22 18:09

Brandon


If you happen to be using the cocos2d libraries, there is a cleaner way to do this, you should configure the cocos2d target's Deployment target to 3.0

like image 28
Rafael Nobre Avatar answered Sep 19 '22 18:09

Rafael Nobre