4

My code is built with a base SDK of 5.1 and deployment of 4.0 and is built using ARC.

I've not experienced any problems previously when running it on a 4.3 test device, however its just crashed for the first time.

Any idea how to fix it?

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

Dyld Error Message:
  Symbol not found: _objc_retainAutoreleasedReturnValue
  Referenced from: /var/mobile/Applications/6AD37C1A-9642-4F0A-87E9-ED33EE45729D/Interactive Messages.app/Interactive Messages
  Expected in: /usr/lib/libobjc.A.dylib
  Dyld Version: 191.3

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   dyld                            0x2fe01080 dyld_fatal_error + 0
1   dyld                            0x2fe02a40 dyld::halt(char const*) + 48
2   dyld                            0x2fe02b00 dyld::fastBindLazySymbol(ImageLoader**, unsigned long) + 172
3   libdyld.dylib                   0x351d544e _dyld_fast_stub_entry(void*, long) + 30
4   libdyld.dylib                   0x351d5374 dyld_stub_binder + 12
5   Interactive Messages            0x00036aee 0x1000 + 219886
6   libobjc.A.dylib                 0x350af5d4 call_load_methods + 96
7   libobjc.A.dylib                 0x350af446 load_images + 50
8   dyld                            0x2fe03d7c _ZN4dyldL12notifySingleE17dyld_image_statesPK11ImageLoader + 64
9   dyld                            0x2fe0a6a8 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) + 236
10  dyld                            0x2fe0aaaa ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 34
11  dyld                            0x2fe020dc dyld::initializeMainExecutable() + 324
12  dyld                            0x2fe06ffe dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**) + 1446
13  dyld                            0x2fe01286 dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*) + 506
14  dyld                            0x2fe01058 _dyld_start + 48
Gruntcakes
  • 37,738
  • 44
  • 184
  • 378

3 Answers3

1

Where was the crash happening? I had the same thing suddenly start happening with the new compiler.

For me I had the code inside a +(void) load override which seemed to have been called before the arclite code was properly linked. I'm not sure this is possible, but moving the same code into +(void) initialize worked fine.

Paul de Lange
  • 10,613
  • 10
  • 41
  • 56
0

[This use to say 4.3 but I was wrong, all documentation says it iOS 4.]

EDIT: Grrr - I started my project a year ago, and wanted to use ARC and blocks. At that time I had some strong reason to use 4.3 not older releases, had to get permission from management, and it was all smooth sailing from then on. Now, I cannot determine why I did this. It's possible that at that time, the SDK was 4.3, and I made the assumption that is what I needed. I strongly recall I had a good reason to request 4.3 (I had just come back from WWDC) but now of course I cannot find anything to substantiate my answer. That said, the original poster seems to have given me the answer for this - so assume changing to 4.3 fixed his run time issue. If I ever find the reason I'll update this answer.

David H
  • 40,852
  • 12
  • 92
  • 138
  • Why does this answer say ARC is supported on 4.0+ but need to set deployment as 4.3? Doesn't setting as 4.3 mean it can't be installed on 4.0? Therefore how is it supported for 4.0? http://stackoverflow.com/questions/7747783/is-arc-really-supported-in-ios-4-the-ios-4-2-sdk-is-missing-arc-related-symbols – Gruntcakes Jul 19 '12 at 14:48
  • 1
    Wrong - ARC is supported from iOS 4.0. From Apple docs... *ARC is supported in Xcode 4.2 for Mac OS X v10.6 and v10.7 (64-bit applications) and for iOS 4 and iOS 5. Weak references are not supported in Mac OS X v10.6 and iOS 4.* – Ashley Mills Jul 26 '12 at 13:15
  • If you'll note the EDIT, I clearly stated the answer was wrong - but left it for posterity (since its what I had originally stated.) Since people seem to read the first line and not the EDIT text, I changed the top line to make it 100% clear. – David H Aug 06 '12 at 13:17
  • Well, he marked it as the answer since it did solve his problem - updating to 4.3 fixed it. That said, he must have had some other issue if in fact ARC is supported in 4.0. In any case I updated the answer. – David H Aug 06 '12 at 16:41
0

I agree with @Paul de Lange, and let me add some more note.

I am not 100% sure, but it seems runtime mechanism has been slightly changed since Xcode 4.4, that ARC-enabled project will start linking libarclite_xxx.a (for iOS4) AFTER class's +(void)load is called (previously, it was BEFORE).

In more detail, method call goes like this in Xcode <= 4.3:

  1. LINKING libarclite_xxx.a
  2. class's +load
  3. class category's +load
  4. int main()
  5. class's +initialize

and in Xcode >= 4.4:

  1. class's +load
  2. LINKING libarclite_xxx.a
  3. class category's +load
  4. int main()
  5. class's +initialize

My app crashed on initial launch due to the addition of @autoreleasepool directly in class's +load, and by moving its implementation to either class's +initialize or class category's +load, everything went all fine.

inamiy
  • 2,896
  • 2
  • 17
  • 13