在Xcode 4.2中为iOS项目安装Core-Plot [英] Installing Core-Plot in Xcode 4.2 for iOS project

查看:84
本文介绍了在Xcode 4.2中为iOS项目安装Core-Plot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Core Plot安装到我的iOS应用中。我已经按照Core Plot网站上的说明进行操作,但它们非常简短,没有截图。我已经粘贴了下面的说明并解释了我被卡住的地方...

I am trying to install Core Plot into my iOS app. I have followed the instructions on the Core Plot website but they are very brief and have no screenshots. I have pasted the instructions below and explained where I am stuck...


首先,将CorePlot-CocoaTouch.xcodeproj文件拖到iPhone中
应用程序的Xcode项目。在
左侧列表中显示项目导航器,然后单击您的项目。

First, drag the CorePlot-CocoaTouch.xcodeproj file into your iPhone application's Xcode project. Show the project navigator in the left-hand list and click on your project.

从目标源列表中选择您的应用程序目标
出现了。单击Build Phases选项卡并展开Target
Dependencies组。单击加号按钮,选择
CorePlot-CocoaTouch库,然后单击添加。这应该确保
Core Plot库将与您的应用程序一起构建。

Select your application target from under the "Targets" source list that appears. Click on the "Build Phases" tab and expand the "Target Dependencies" group. Click on the plus button, select the CorePlot-CocoaTouch library, and click Add. This should ensure that the Core Plot library will be built with your application.

完成!


Core Plot是作为iPhone的静态库构建的,所以你需要
从$下拖动libCorePlot-CocoaTouch.a静态库b $ b CorePlot-CocoaTouch.xcodeproj组到应用程序目标的构建阶段组中的链接二进制文件与
库组,您刚刚进入b $ b组。

Core Plot is built as a static library for iPhone, so you'll need to drag the libCorePlot-CocoaTouch.a static library from under the CorePlot-CocoaTouch.xcodeproj group to the "Link Binaries With Libraries" group within the application target's "Build Phases" group you were just in.

完成!


您还需要指向正确的标题位置。在
Build设置下,将Header Search Paths设置为从您的应用程序
到Core Plot
源树中的framework /子目录的相对路径。确保递归此标头搜索路径。你需要将-ObjC添加到其他链接器标志(从Xcode 4.2开始,似乎不需要
-all_load,但是旧的Xcode版本可能需要它。)

You'll also need to point to the right header location. Under your Build settings, set the Header Search Paths to the relative path from your application to the framework/ subdirectory within the Core Plot source tree. Make sure to make this header search path recursive. You need to add -ObjC to Other Linker Flags as well (as of Xcode 4.2, -all_load does not seem to be needed, but it may be required for older Xcode versions).

我不明白这一点!


核心情节是基于Core Animation,如果你还没有,请将
QuartzCore框架添加到你的应用程序项目中。

Core Plot is based on Core Animation, so if you haven't already, add the QuartzCore framework to your application project.

完成!


最后,您应该可以通过插入以下行来导入所有Core Plot类和
数据类型项目中适当的源
文件:

Finally, you should be able to import all of the Core Plot classes and data types by inserting the following line in the appropriate source files within your project:

#import "CorePlot-CocoaTouch.h"


完成!

是任何能够将我正在努力的指令放入更多非专业人员条款的人吗?

Is anyone able to put the instruction I am struggling with into more laymans terms?

推荐答案

看到我如何写这些指示,我可以采取刺澄清您遇到问题的部分。

Seeing as how I wrote those instructions, I can take a stab at clarifying the part you're having trouble with.

您需要设置标题搜索路径,以便在包含 CorePlot-CocoaTouch时.h ,Xcode知道从哪里拉出来。它位于标题搜索路径构建设置下的应用程序项目的构建设置中。它看起来像如下:

You'll need to set the header search path so that when you include CorePlot-CocoaTouch.h, Xcode knows where to pull that from. This is located within the Build Settings for your application project under the Header Search Paths build setting. It looks like the following:

双击标题搜索路径的字段并调出此弹出窗口:

Double-click on the field for the header search paths and bring up this popup:

此处指定的路径是相对路径从Xcode项目文件到安装Core Plot的目录的路径。在我的情况下,我的应用程序项目目录和Core Plot都在同一个〜/ Development目录中,所以相对路径涉及退回一个级别( ../ )并转到我已克隆框架的 core-plot 目录。然后,您需要指向框架子目录,其中存储了实际的框架源。

The path you specify here is the relative path from your Xcode project file to the directory where you installed Core Plot. In my case, I had both my application project directory and Core Plot located within the same ~/Development directory, so the relative path involved stepping back a level (the ../) and going to the core-plot directory that I had cloned the framework into. You then need to point to the framework subdirectory, where the actual framework source is stored.

最后,检查路径左侧的小方框使报头搜索递归,因此它会找到包含在这个子目录中的标题。

Finally, checking the little box to the left of the path makes the header search recursive, so it will find headers contained in subdirectories of this one.

就链接器标志而言,找到你的其他链接器标志在这些相同的构建设置中,并将 -ObjC 添加到链接器标志列表中:

As far as the linker flags go, find your Other Linker Flags within these same Build Settings and add -ObjC to the list of linker flags:

这是必需的,以便来自的符号我们在静态库中使用的类别会被正确地提取到您的项目中。正如我所指出的,我们以前需要将 -all_load 添加到此处以解决链接器错误,但Xcode 4.2中的LLVM修复了此问题。这很好,因为 -all_load 有时会引入重复的符号并打破某些第三方框架的构建。

This is needed so that symbols from the categories we use in the static library get pulled into your project properly. As I indicate, we used to need to add -all_load to this as well to work around a linker bug, but LLVM in Xcode 4.2 fixes this. That's good, because -all_load sometimes introduced duplicate symbols and broke building against certain third-party frameworks.

希望,这应该清除指令的特定部分。我尽力让这些易于理解并让它们与最新的Xcode版本保持同步,但也许我还不够详细。如果你完成所有其他步骤,你应该好好去。

Hopefully, this should clear up that particular section of the instructions. I tried to do my best to make those easy to follow and keep them up to date with the latest Xcode versions, but perhaps I wasn't detailed enough. If you got through all the rest of the steps fine, you should be good to go.

这篇关于在Xcode 4.2中为iOS项目安装Core-Plot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆