CocoaLumberjack Error: Character not found: _objc_storeStrong

I am relatively new to iOS development and trying to implement CocoaLumberjack protocols.

I downloaded the last source from https://github.com/robbiehanson/CocoaLumberjack , included the necessary files in my project, made the necessary code changes and am getting a runtime linker error, which will be given below.

The environment is Xcode 4.2 Build 4C199, with the Target set to Device = iPad and DeploymentTarget = 4.3. The project was originally written using save / release, so I left the original source as it was by adding the compiler flag β€œ-fobjc-arc” for the Lumberjack files that I use: DDFileLogger.m, DDLog.m and DDTTYLogger.m.

Console output:

GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Fri Sep 16 06:56:50 UTC 2011) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys001 sharedlibrary apply-load-rules all target remote-mobile /tmp/.XcodeGDBRemote-10996-56 Switching to remote-macosx protocol mem 0x1000 0x3fffffff cache mem 0x40000000 0xffffffff none mem 0x00000000 0x0fff none [Switching to process 11779 thread 0x2e03] [Switching to process 11779 thread 0x2e03] dyld: lazy symbol binding failed: Symbol not found: _objc_storeStrong Referenced from: /var/mobile/Applications/32E4EEB9-765E-4C72-83C8-F5707253AA99/Demo.app/Demo Expected in: /usr/lib/libobjc.A.dylib dyld: Symbol not found: _objc_storeStrong Referenced from: /var/mobile/Applications/32E4EEB9-765E-4C72-83C8-F5707253AA99/Demo.app/Demo Expected in: /usr/lib/libobjc.A.dylib warning: Attempting to create USE_BLOCK_IN_FRAME variable with block that isn't in the frame. (gdb) 

My project initializes the environment as follows: fileLogger is the instance variable defined in the corresponding AppDelegate.h file:

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { /* * Configure the Lumberjack logging framework (we'll use it instead of NSLog) */ // the TTY logger is the Xcode console [DDLog addLogger:[DDTTYLogger sharedInstance]]; // we'll also use a file logger fileLogger = [[DDFileLogger alloc] init]; fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling fileLogger.logFileManager.maximumNumberOfLogFiles = 7; [DDLog addLogger:fileLogger]; // Override point for customization after application launch. DDLogInfo(@"didFinishLaunchingWithOptions: entered"); // create instance of the view controller MainViewController *aViewController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil]; self.mainViewController = aViewController; // same as: [self setMainViewController:aViewController]; [aViewController release]; // Add the main view controller view to the window and display. self.window.rootViewController = self.mainViewController; [self.window makeKeyAndVisible]; return YES; } 

Has anyone encountered this problem and was aware of a solution or workaround? Is what I'm doing even possible ... with mixed ARC and non-ARC files in the project?

+7
source share
2 answers

I just heard from one of CocoaLumberjack developers, here is what he said:

There seems to be a bug in the (possibly) LLVM compiler. Here is what I Discovered:

If you have an Xcode project without enabling ARC by default, and you have a file that uses ARC (via -fobjc-arc), and this file tries to alloc / init in '+ (void) initialize', then it will explode at runtime .

It seems to work if you convert a project to ARC ...

EDIT: Additional information from the developer:

Tag 1.2.3 can be used without ARC.

You can capture the archive here:

https://github.com/robbiehanson/CocoaLumberjack/tags

+4
source

For future reference, this appears to be a flaw in the current Xcode toolkit, which seems to forget to include the ARC library when the currently created target is disabled by ARC support (and uses static libraries supporting ARC). You can easily get the linker to enable the library using the -fobjc-arc flag, see this related question for a full description.

+8
source

All Articles