Core Plot and Xcode 5.1 - How to convert Core Plot to ARC?

三世轮回 提交于 2019-12-08 03:31:04

问题


I just installed Xcode 5.1 and found that it definitely requires projects to use ARC. I get

error: garbage collection is no longer supported

when trying to compile Core Plot (version 1.4). Out of curiosity I told Xcode to convert Core Plot to ARC. But it fails with

ARC forbids Objective-C objects in struct

in file CPTPlatformSpecificFunctions.m. I don't want to dive into Core Plot and break something by trying to fix this or similar errors. Is there a compiler setting I have overlooked? Or will there be a Core Plot version which uses ARC soon? Thanks, Dirk


回答1:


Xcode 5.1 doesn't require projects to use ARC, it just finally drops support for garbage collection. Core Plot was never a strictly garbage-collected framework, but it did support building for garbage collection.

You can click on the "Not Now" option when presented with that dialog on opening the Core Plot project, then go to the project build settings. Blank out or remove the GCC_ENABLE_OBJC_GC setting under the user settings at the bottom of the project and the project will build just fine as a manually reference counted target. That's perfectly usable within an ARC or non-ARC application.




回答2:


If you import the static library you can use core plot in ARC projects. I'm doing so in my ARC app now. Here is a link to the instructions on how to do this:

http://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications

All you need is the library "...core-plot-master/build/Debug-iphoneos/" is where I found it. And then import the headers which can be found in the "....core-plot-master/framework/source" folder. Then follow the directions.

Hope that helps!



来源:https://stackoverflow.com/questions/22335957/core-plot-and-xcode-5-1-how-to-convert-core-plot-to-arc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!