xcode 将 ShareKit 添加到项目中的困难
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9091579/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difficulties adding ShareKit to project
提问by user339946
Okay, so I seem to be having a bit of difficulty in adding ShareKit to my project.
好的,所以我似乎在将 ShareKit 添加到我的项目时遇到了一些困难。
I've downloaded the latest version via Git. I'm dragging and dropping the 'ShareKit' folder from Finder because you can't do it drag and drop from the xcode project.
我已经通过 Git 下载了最新版本。我正在从 Finder 拖放“ShareKit”文件夹,因为您无法从 xcode 项目中拖放。
I've figured out how to ignore ARC by setting ShareKit files to -fno-objc-arc in my Target > Build Phases> Compile Sources. So that gets rid of my arc warnings.
我已经想出了如何通过在我的目标> 构建阶段> 编译源中将 ShareKit 文件设置为 -fno-objc-arc 来忽略 ARC。这样就消除了我的电弧警告。
However, how do I get my "Submodules" folder to come along too? In the ShareKit project it doesn't appear in the xcode folder hierarchy, but it is in the project folder and you can access it through Finder. Sharekit's demo project compiles fine.
但是,如何让我的“子模块”文件夹也出现?在 ShareKit 项目中,它不会出现在 xcode 文件夹层次结构中,但它位于项目文件夹中,您可以通过 Finder 访问它。Sharekit 的演示项目编译良好。
So without Submodules, I get errors like "SSKeyChain.h not found" (https://github.com/ShareKit/ShareKit/issues/191) among others. So I drag and drop the entire Submodules folder into my project, and that solves some, but creates others. The Submodules folder is very convoluted and I'll see errors referring to lines trying to import Cocoa/Cocoa.h, which is for mac and not iOS I believe. Some of the Submodules files are looking for files like "SampleAPIKey.h" and if they're not there, hell if I know why they aren't.
因此,如果没有子模块,我会收到诸如“未找到 SSKeyChain.h”(https://github.com/ShareKit/ShareKit/issues/191)之类的错误。所以我将整个 Submodules 文件夹拖放到我的项目中,这解决了一些问题,但创建了其他一些。Submodules 文件夹非常复杂,我会看到有关尝试导入 Cocoa/Cocoa.h 的行的错误,我相信这是针对 mac 而不是 iOS。一些子模块文件正在寻找像“SampleAPIKey.h”这样的文件,如果它们不存在,如果我知道它们为什么不存在,那就太糟糕了。
Has anyone had experience with figuring out how to do this?
有没有人有过弄清楚如何做到这一点的经验?
采纳答案by larick
Note: Wednesday, September 19, 2012
注:2012 年 9 月 19 日,星期三
In a project that I use ShareKit, after building in Xcode 4.5, in I was getting a number of warnings and additionally a fatal error when trying to build for the iOS 6 Simulator. After having problems updating the ShareKit code via the instructions in the ShareKit github FAQ I decided to remove and then read SK to my project from scratch. The new install instructions that on github are greatly revised and following step by step worked without a hitch, so the work around that I previously provided is most likely out of date.
在我使用 ShareKit 的一个项目中,在 Xcode 4.5 中构建后,在尝试为 iOS 6 模拟器构建时,我收到了许多警告和另外一个致命错误。在通过 ShareKit github FAQ 中的说明更新 ShareKit 代码时遇到问题后,我决定删除然后从头开始将 SK 读取到我的项目中。github 上的新安装说明进行了很大的修订,并且按部就班地进行了操作,因此我之前提供的解决方法很可能已经过时了。
End of note Wednesday, September 19, 2012
2012 年 9 月 19 日,星期三
I had some difficulty doing this myself but did get it working. Assuming that you are using Xcode 4.x make sure that you follow the directions in Step 2 of the install instructions re that version, but it took a number of tries as the instructions were not perfectly clear to me.
我自己在做这件事时遇到了一些困难,但确实让它起作用了。假设您使用的是 Xcode 4.x,请确保您按照该版本安装说明的第 2 步中的说明进行操作,但由于我对说明并不十分清楚,因此进行了多次尝试。
What worked for me was to 1) drag the Submodules/ShareKit.xcodeproj file from the Finder to the project I was adding SK to at the bottom of the tree navigator UNDER the other groups and NOT adding it as if it was an additional project necessitating creating a workspace, 2) then, I dragged the Classes/ShareKit folder from the tree under the newly dragged ShareKit.xcodeproject into the main project tree and when prompted choose "Create folder references for any added folders", and finally 3) delete the ShareKit.xcodeproject and click "Remove Reference Only".
对我有用的是 1) 将 Submodules/ShareKit.xcodeproj 文件从 Finder 拖到我在其他组下的树导航器底部添加 SK 的项目中,而不是将其添加为一个额外的项目创建一个工作区,2) 然后,我将 Classes/ShareKit 文件夹从新拖动的 ShareKit.xcodeproject 下的树拖到主项目树中,并在提示时选择“为任何添加的文件夹创建文件夹引用”,最后 3) 删除ShareKit.xcodeproject 并单击“仅删除引用”。
Hope this helps.
希望这可以帮助。