6

Xcode 4.4, Mountain Lion, llvm 4.0 compiler. I build my app, it works on ios5, ios6 devices, but on iphone 3g with ios 4.2 I have such error:

dyld: lazy symbol binding failed: Symbol not found: _objc_storeStrong
Referenced from: /var/mobile/Applications/68B78A19-71E6-4BDA-B997-B7DED4D02429/iGuides.app/iGuides
Expected in: /usr/lib/libobjc.A.dylib

dyld: Symbol not found: _objc_storeStrong
Referenced from: /var/mobile/Applications/68B78A19-71E6-4BDA-B997-B7DED4D02429/iGuides.app/iGuides
Expected in: /usr/lib/libobjc.A.dylib

On Xcode 4.3 everything was working, because I use only strong and unsafe_unretained modifiers.

I see, that no arc libs were linked to my app.

I was trying to link manually with libarclite_iphoneos.a, no reaction. I added -fobj-arc to link flags, no reaction.

I thought, that iPhone 3g support will be dropped in XCode 4.5, not 4.4. Is it so?

Gleb Tarasov
  • 885
  • 11
  • 15
  • I can confirm that Xcode Version 4.4.1 (4F1003) Running on Mountain Lion CAN build and deploy a project using ARC (minus `weak`s) to a 2nd Generation iPod touch running iOS 4.2.1. – NJones Aug 11 '12 at 22:28
  • Same problem here, I haven't found a solution yet... – Andrea Aug 13 '12 at 01:51
  • 1
    Andrea, if you are using iVersion or iRate then you need to update to the latest versions. Xcode 4.4 introduced a bug which I've had to work around whereby ARC isn't properly initialised when the +(void)load method of a class is called. – Nick Lockwood Aug 18 '12 at 23:44

2 Answers2

3

I've just found problem. Error was because of iRate library, when I remove reference to this lib, everything starts working.

Upd: after updating to last version everything works nice. Thank you @Nick Lockwood for explanation: on iOS arclite lib loads after [class load] methods executed. So you need to delay initialization. In iRate he inserted performOnTheMainThread in load method.

Gleb Tarasov
  • 885
  • 11
  • 15
  • This was fixed in the latest release - did you try updating? – Nick Lockwood Aug 18 '12 at 21:38
  • yes, sure, after update everything works, thx! Updated answer. – Gleb Tarasov Aug 19 '12 at 09:23
  • @NickLockwood do you have a link to your explanation here? I'd be very interested in reading it as I'm seeing a similar problem :) – Glen T Aug 24 '12 at 21:58
  • @NickLockwood actually I think I understand pilot34's description now. Your delayed initialization worked for me too - except I used GCD. Thanks! – Glen T Aug 24 '12 at 22:50
  • 1
    Basically if you alloc any objects in the +(void)load method of your class with ARC enabled it blows up on iOS 4.x. You can still use the load method, but tell it to call another method on the main thread so that execution is delayed until after the main run loop has started up, by which time ARCLite has initialised properly. (Note: this also affects Mac OS 10.6.x, which also uses ARCLite). – Nick Lockwood Aug 25 '12 at 08:00
1

Try to add -fobjc-arc in Other Linker Flags.

Johnnywho
  • 5,541
  • 2
  • 27
  • 20
  • Thank you for reply, I have arc project with some linked no-arc static libraries. If I add link flag -fobjc-arc to my project, nothing happens, if I add this flag to static libraries project: I recieve error ("unknown option character `f' in: -fobjc-arc"), like in [comments](http://stackoverflow.com/questions/8756418/static-library-with-arc-support-linked-to-non-arc-project-causing-linker-errors) – Gleb Tarasov Aug 10 '12 at 10:58
  • Add the flag only to the file that has the +(void)load method (from the Build steps > Compile) – Rivera Sep 05 '12 at 06:20