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

3

15

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!

Ohmage answered 14/10, 2011 at 0:23 Comment(0)
C
42

__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

Chicory answered 14/10, 2011 at 0:27 Comment(2)
i need to keep the deployment target to 4.2 is there anyway i can get around it?Iveyivie
Use __unsafe_unretained in place of __weak. Note that you loose a bit of ARC functionality in this case.Chicory
R
6

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.

Ringer answered 9/1, 2012 at 20:4 Comment(0)
J
0

Change Development Targert 6.0.

Select Your Project > target > development target > change to 6.0

Jecon answered 25/4, 2014 at 4:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.