如何将 RestKit Framework (restkit.org) 与 xCode 4 集成?

发布于 2024-11-04 05:38:44 字数 163 浏览 2 评论 0原文

我按照 github 页面上的说明进行操作,但出现了问题(最肯定是我:P)但是,您知道在 Xcode4 RestKit 中集成/使用任何好的教程吗?

谢谢!

I followed the instructions on the github page but something is wrong (most certainly is me: P) but, Do you know about any good tutorial for integrate / use in Xcode4 RestKit?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

海夕 2024-11-11 05:38:44

从此链接下载最新版本 http://restkit.org/

并解压 zip 文件夹,您将找到一个 ReadMe.md 文件,其中解释了安装 Xcode 4.x 的步骤如下所示

Xcode 4.x (Git Submodule)

  1. 添加子模块: git submodule add git://github.com/RestKit/RestKit.git RestKit
  2. 打开您希望在 Xcode 中添加 RestKit 的项目。
  3. 聚焦您的项目并选择“查看”菜单 > “导航员”> “项目”可查看项目文件列表。
  4. 将 RestKit.xcodeproj 文件从 Finder 拖放到“”.xcodeproj 上。
  5. 单击左侧边栏中的项目名称,以在窗口右侧窗格中打开项目设置视图。
  6. 在中间窗格中,您将看到项目的 PROJECTTARGETS 标题。单击您的项目名称,然后选择顶部的构建设置以打开整个项目的构建设置编辑器。
  7. 找到标头搜索路径设置。双击并添加一个新条目。将搜索路径添加到已添加到项目中的 "$(SOURCE_ROOT)/RestKit/Build" 目录。 请勿选中递归复选框。
  8. 找到库搜索路径设置。双击并添加一个新条目。将搜索路径添加到您已添加到项目中的“$(SOURCE_ROOT)/RestKit/Build/$(BUILD_STYLE)-$(PLATFORM_NAME)”目录。
    注意:仅当您使用 DerivedData 时才需要这样做。
  9. 找到其他链接器标志条目并双击它。使用+按钮添加新条目并输入-ObjC -all_load。使用完成按钮关闭编辑器。
  10. 在编辑器窗格中间的 TARGETS 列表中找到您想要添加 RestKit 的目标。选择它以在窗口的右窗格中打开目标设置编辑器。
  11. 单击窗口顶部的构建阶段选项卡以打开构建阶段编辑器。
  12. 单击目标依赖项将二进制文件与库链接项旁边的显示三角形。
  13. 目标依赖项部分中,单击+按钮打开目标选择表。单击RestKit聚合目标(它将具有靶心图标),然后单击添加按钮创建依赖项。
  14. 将二进制文件与库链接部分中,单击+按钮打开库选择表。在这里,我们需要指示目标链接所有必需的 RestKit 库和几个系统库。选择以下每一项(一次一项或按住 Command 键一次选择所有项),然后单击添加按钮:
    • libRestKitCoreData.a - 可选。仅当您使用核心数据时才需要。
    • libRestKitJSONParserJSONKit.a
    • libRestKitNetwork.a
    • libRestKitObjectMapping.a
    • libRestKitSupport.a
    • CFNetwork.framework
    • CoreData.framework - 可选。仅当您使用核心数据时才需要
    • MobileCoreServices.framework
    • SystemConfiguration.framework
    • libxml2.dylib - 可选。仅当您从 XML 有效负载进行映射并将 libRestKitXMLParserLibxml.a 链接到您的应用时才需要。
  15. 在继续之前,请验证所有库是否都显示在将二进制文件与库链接部分中。

恭喜,您现在已完成将 RestKit 添加到基于 Xcode 4 的项目中!

现在,您只需在应用程序中的适当位置添加 RestKit 库的包含内容即可。相关内容包括:

#import <RestKit/RestKit.h>
// And if you are using Core Data...
#import <RestKit/CoreData/CoreData.h>

Download the latest version from this Link http://restkit.org/

and extract the zip folder and you will find a ReadMe.md file which explains you steps to install for Xcode 4.x as shown below

Xcode 4.x (Git Submodule)

  1. Add the submodule: git submodule add git://github.com/RestKit/RestKit.git RestKit
  2. Open the project you wish to add RestKit to in Xcode.
  3. Focus your project and select the "View" menu > "Navigators" > "Project" to bring the project file list into view.
  4. Drag the RestKit.xcodeproj file from the Finder and drop it on your "".xcodeproj.
  5. Click on your project's name in the sidebar on the left to open the project settings view in the right pane of the window.
  6. In the middle pane you will see PROJECT and TARGETS headers for your project. Click on your project name, then select Build Settings along the top to open the Build Settings editor for your entire project.
  7. Find the Header Search Paths setting. Double click and add a new entry. Add a search path to the "$(SOURCE_ROOT)/RestKit/Build" directory you have added to your project. DO NOT check the Recursive checkbox.
  8. Find the Library Search Paths setting. Double click and add a new entry. Add a search path to the "$(SOURCE_ROOT)/RestKit/Build/$(BUILD_STYLE)-$(PLATFORM_NAME)" directory you have added to your project.
    NOTE: This is only necessary if you are NOT using DerivedData.
  9. Find the Other Linker Flags entry and double click it. Use the + button to add a new entry and enter -ObjC -all_load. Dismiss the editor with the Done button.
  10. Locate the target you wish to add RestKit to in the TARGETS list in the middle of the editor pane. Select it to open the target settings editor in the right pane of the window.
  11. Click the Build Phases tab along the top of the window to open the Build Phases editor.
  12. Click the disclosure triangles next to the Target Dependencies and Link Binary with Libraries items.
  13. In the Target Dependencies section, click the + button to open the Target selection sheet. Click on the RestKit aggregate target (it will have the bulls-eye icon) and click the Add button to create a dependency.
  14. In the Link Binary with Libraries section, click the + button to open the Library selection sheet. Here we need to instruct the target to link against all the required RestKit libraries and several system libraries. Select each of the following items (one at a time or while holding down the Command key to select all of them at once) and then click the Add button:
    • libRestKitCoreData.a - Optional. Only necessary if you are using Core Data.
    • libRestKitJSONParserJSONKit.a
    • libRestKitNetwork.a
    • libRestKitObjectMapping.a
    • libRestKitSupport.a
    • CFNetwork.framework
    • CoreData.framework - Optional. Only necessary if you are using Core Data
    • MobileCoreServices.framework
    • SystemConfiguration.framework
    • libxml2.dylib - Optional. Only necessary if you are mapping from XML payloads and link libRestKitXMLParserLibxml.a into your app.
  15. Verify that all of the libraries are showing up in the Link Binary with Libraries section before continuing.

Congratulations, you are now done adding RestKit into your Xcode 4 based project!

You now only need to add includes for the RestKit libraries at the appropriate places in your application. The relevant includes are:

#import <RestKit/RestKit.h>
// And if you are using Core Data...
#import <RestKit/CoreData/CoreData.h>
无风消散 2024-11-11 05:38:44

我发现本教程对于使其在 xCode 4.0 上运行非常有用。

http://liebke.github.com/restkit-github-client-example/

I found this tutorial very useful to make it work on xCode 4.0.

http://liebke.github.com/restkit-github-client-example/

緦唸λ蓇 2024-11-11 05:38:44

我按照这个陡峭的 https://github 进行了构建。 com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x 和 guoleii 是对的。但我需要更改所有者目录。

I did my build following this steeps https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x and guoleii is right. But I needed to change the owner directory.

月光色 2024-11-11 05:38:44

您看过 RestKit 的 Google 群组中的这个帖子吗?

链接 1
链接 2

尝试在此处进行搜索。但就目前而言,RestKit 和 Xcode 4 似乎存在很多问题,甚至还有一个 YouTube 视频显示问题(没有显示操作方法)。

Have you seen this threads from RestKit's Google Group?

link 1
link 2

Try searching there. But for now, there seems to be A LOT of issues with RestKit and Xcode 4, there's even a YouTube video showing the problems (none showing a how-to).

没企图 2024-11-11 05:38:44

您是否根据 github.com/RestKit 上的 wiki 页面“Installing RestKit in Xcode 4.x”构建了 RestKit?我认为有一点错误。这是我的解决方案: 1. 在“构建阶段”-> “Link Binary With Libraries”,删除 RestKit.framework 并添加 Security.frameWork 2. 再次构建

即可。

did you build RestKit according to the wiki page "Installing RestKit in Xcode 4.x" on github.com/RestKit? i think there is a little mistake. here is my solution: 1. in "Build Phases" -> "Link Binary With Libraries", delete the RestKit.framework and add Security.frameWork 2. build again

then it works.

梦在深巷 2024-11-11 05:38:44

我刚刚尝试在新创建的 Xcode 5 iOS 7.0 项目上安装 RestKit。我尝试下载该项目并按照上述步骤操作,但我丢失了 RestKit/Vendor 文件夹中的大部分内容。经过一些研究后,我采用了子模块策略,这让我从这些文件夹中获得了所有信息。

从命令提示符将目录更改为您的项目文件夹,对我来说,

$ cd Documents/Projects/NewlyCreatedApp

如果您没有 git 存储库,则应该从那里运行此命令
注意:你必须下载 git 来安装它,如果你还没有安装它

$ git init

,那么你必须运行这些命令将restkit下载到你的项目文件夹中

$ git submodule add git://github.com/RestKit/RestKit.git
$ git submodule update --init --recursive

之后,你应该转到上面 Nakkeeran 的答案并从步骤 2 开始,设置过程。在第 7 步中,系统会要求您将“$(SOURCE_ROOT)/RestKit/Build”添加到标头搜索路径中,但经过仔细检查,RestKit 框架不再具有构建文件夹,因此您应该将其更改为“$(SOURCE_ROOT)/ RestKit/Code”以适合当前版本的 Rest Kit

我希望这会有所帮助,这里是我发布的子模块信息的链接。
RestKit安装子模块方法

I just tried to install RestKit on a newly created Xcode 5 iOS 7.0 project. I tried downloading the project and following the steps above, but i was missing most of the content with in the RestKit/Vendor folder. After doing a bit of research i did the submodule tactic and that got me all of the information from those folders.

From the command prompt change directory into your project folder, for me it was

$ cd Documents/Projects/NewlyCreatedApp

From there you should run this command if you have no git repository
Note: you must download git to install this, if you have not already

$ git init

after that you must run these commands to download restkit into your project folder

$ git submodule add git://github.com/RestKit/RestKit.git
$ git submodule update --init --recursive

After that, you should go up to Nakkeeran's answer above and start from step 2, to set up the process. In step 7 you will be asked to add "$(SOURCE_ROOT)/RestKit/Build" to your header search paths, but upon closer inspection the RestKit framework no longer has the build folder so you should change that to "$(SOURCE_ROOT)/RestKit/Code" to fit the current version of Rest Kit

I hope this helps, and here is a link to the submodule information i posted.
RestKit Installation Submodule Method

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文