Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone 4 iOS5 Core Plot and ARC error:"The current deployment target does not support weak references"

I've converted my project to iOS 5 and enabled ARC. Now I need to integrate core plot with the project. When I try to instantiate a sample controller included with the Core Plot, I get about 20 errors as follows:

The current deployment target does not support automated __weak references

I've explicitly said fno-objc-arc next to the controller's name in the build settings.

What else do I need to run core plot with ARC enabled?

Thank you!

like image 243
Alex Stone Avatar asked Oct 14 '11 00:10

Alex Stone


2 Answers

__weak references only work on iOS 5 and above. If you have the deployment target set to anything earlier, then you'll get the error. Basically, if you want to deploy to earlier devices you can't use automated __weak references. The substitute would be __unsafe_unretained

like image 166
FeifanZ Avatar answered Oct 25 '22 10:10

FeifanZ


While Inspire48's answer broadly covers the fact that __weak references are not supported in versions of iOS earlier than 5.0, this particular problem was due to Core Plot's headers not being made completely ARC compatible.

This was fixed in the Mercurial repository a few months ago, so if you want to use Core Plot within an ARC-enabled project, you need to grab the latest code from the repository. The 0.9 snapshot does not interact well with ARC because of items like this in its headers.

The Core Plot framework code in the repository also supports targeting back to iOS 4.0 and Snow Leopard with ARC enabled in your application (I believe 3.0 and Leopard without ARC, as well), so you don't need to target 5.0 to use ARC with Core Plot.

like image 36
Brad Larson Avatar answered Oct 25 '22 11:10

Brad Larson