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!
__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
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.
Change Development Targert 6.0.
Select Your Project > target > development target > change to 6.0
精彩评论