iOS: symbol not found _ojbc_loadweakretained while switched target to ios 4.3 (arc)

At the beginning we built our iOS app targeting 5.0+ and used ARC to simply memory management. Later for backward compatibility, we decided to support iOS 4.3. Then I just

  1. Installed iOS 4.3 simulator
  2. Modified app deployment target to 4.3
  3. Clean, build, run

But the app quit unexpectly with following output

dyld: Symbol not found: _objc_loadWeakRetained

Referenced from: /Users/xxx/Library/Application Support/iPhone Simulator/4.3.2/Applications/16E98912-33B5-4660-A9A3-879D92735E44/myApp.app/myApp

Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation

I knew 4.3 didn't support weak reference, but it's weird that compiler never complained at compiling time, it simply crashed at runtime.

UPDATED: I used unsafe_unretained instead of weak keyword, the app ran anyway. But I got lots of warnings like

__NSAutoreleaseNoPool(): Object 0x564bd90 of class __NSArrayM autoreleased with no pool in place - just leaking"* '

Was it normal? How to eliminate these warnings?

Answers


Well, it would be interesting to see if you change the deployment target back to 5.1 if the problem goes away. My guess is it will not.

The only ways I know of to get this kind of error are:

1) is to create a concurrent NSOperation, then not provide a runloop/autorelease pool for it 2) do not create an autorelease pool in main.m 3) create a NSThread using an object that , then try to message an object on that thread without having created an autorelease pool

Assuming the problem is most likely 3), you can find out how to create a pool for the thread in this past discussion


Need Your Help

Asset Catalog UIImage Incorrectly Sized based on Device and Orientation

ios objective-c uiimage orientation asset-catalog

I'm trying to display a background image to the first view that I show in my app on launch that is the same image shown as the LaunchImage.

OpenCV - C++ - How do Convert a cv::Scalar to return a pointer in a C wrapper for cv::Scalar?

c++ function opencv wrapper

I'm working with the Arjun Comar version of OpenCV 3.0 here https://github.com/arjuncomar/opencv ...Arjun Comar updated this version of OpenCV to auto generate C wrappers for all OpenCV functions so