Three20 v1.1 和 Xcode 4
有没有一种简单的方法可以让 Three20 v1.1 在 xCode 4 下工作? 我按照 http://third20.info/article/2011-03- 上的步骤操作10-Xcode4-Support 但这似乎是针对大师的。我使用 v1.1,就像使用 TTLauncher 一样。
该项目可以正常构建,并在 iPhone 上完美运行。 但是当我想创建存档(用于分发的 IPA)时,我收到 18 个错误和 8 个警告。
第一个是:
../scripts/Protect.command: line 23: cd: /Users/XXX/Library/Developer/Xcode/DerivedData/iDoms-cmyivarwxpbvqdfnyclqdrikrtmw/ArchiveIntermediates/iDoms/BuildProductsPath/Release-iphoneos/../three20/Three20UICommon: No such file or directory
大多数其他人都“没有这样的文件或目录”,例如: #import "Three20Core/TTGlobalCoreLocale.h
"
或“未声明(首次使用函数)”,来自“我认为没有此类文件或目录问题”。
在我的“标题搜索路径”中,我有:
$(BUILT_PRODUCTS_DIR)/../three20
$(BUILT_PRODUCTS_DIR)/../../three20
../../three20/Build/Products/three20
/usr/include/libxml2
任何帮助将不胜感激!
Is there an easy way of getting Three20 v1.1 to work under xCode 4?
I followed the steps on http://three20.info/article/2011-03-10-Xcode4-Support but that seems to be for the master. I use v1.1 as I use the TTLauncher.
The project builds fine with a normal build, and runs perfect on an iPhone.
But when I want to create the archive (for the IPA for distribution) then I get 18 errors and 8 warnings.
The first one is:
../scripts/Protect.command: line 23: cd: /Users/XXX/Library/Developer/Xcode/DerivedData/iDoms-cmyivarwxpbvqdfnyclqdrikrtmw/ArchiveIntermediates/iDoms/BuildProductsPath/Release-iphoneos/../three20/Three20UICommon: No such file or directory
Most others are 'no such file or directory' on e.g.:#import "Three20Core/TTGlobalCoreLocale.h
"
or 'undeclared (first use of function)' which comes from the 'no such file or directory issue I presume'.
In my 'Header search paths' I have:
$(BUILT_PRODUCTS_DIR)/../three20
$(BUILT_PRODUCTS_DIR)/../../three20
../../three20/Build/Products/three20
/usr/include/libxml2
Any help would be very appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只是补充一下 Colin 的答案:您可以使用 Xcode 的依赖项目功能来使用 Three20,即使 Three20 网站说它不是“官方支持”:
在您的工作区中,右键单击项目导航器中的空白区域。选择“将文件添加到“我的工作区””,然后选择 Three20 项目 (
third20/src/Three20/Three20.xcodeproj
)。这是您需要添加的唯一项目:无需手动添加 Three20 子项目。在导航器中选择您的项目,转到“构建阶段”,打开“将二进制文件与库链接”,单击左下角的“+”,然后添加 Three20 库:
libThree20.a
、libThree20Core.a
、libThree20Network.a
、libThree20Style.a
、libThree20UI.a
、libThree20UICommon .a
和libThree20Navigator.a
。这将导致 Xcode 在您构建项目时构建 Three20。按照 Colin 的回答将
${BUILD_DIR}/third20
添加到包含路径:转到构建设置,双击“标题搜索路径”,然后添加${BUILD_DIR}/ Three20
(当您关闭对话框时,它将显示为build/third20
)。将
third20/src/Three20.bundle
添加到您的资源。如果您还没有这样做,添加链接器标志 -ObjC 和 -all_load 可能也是一个好主意(同一对话框,设置“其他链接器标志”)。
上面的步骤足以编译代码。要使“存档”也正常工作,您需要:
添加
$(BUILT_PRODUCTS_DIR)/../ Three20
和$(BUILT_PRODUCTS_DIR)/../../ Three20< /code> 到标题搜索路径设置。如果不这样做,您将收到无法找到 Three20 标头的编译错误。
对于所有 Three20 项目(因此不仅仅是顶级项目),请转到“构建设置”并将“跳过安装”设置为“是”。如果不这样做,项目将会构建,但您将无法创建 IPA。
确保您的产品名称(选择您的目标,转到“构建设置”,然后设置“产品名称”)不包含空格,否则存档将无法工作。
最后,如果您遇到以下错误作为 ld: 找不到 -lThree20 的库,并且您正在使用自定义构建配置(例如 AdHoc),请确保也将相同的构建配置添加到每个 Three20 项目(只需复制 Release配置)。
Just to add to Colin's answer: you can use Xcode's dependent projects feature to use three20, even though the three20 website says it's not "officially supported":
In your workspace, right-click on the empty space in your project navigator. Select "Add files to "My Workspace", and select the three20 project (
three20/src/Three20/Three20.xcodeproj
). This is the only project you need to add: it is not necessary to manually add the three20 subprojects.Select your project in the navigator, go to Build Phases, open "Link binary with libraries", click on the "+" in the bottom left corner, and add the Three20 libraries:
libThree20.a
,libThree20Core.a
,libThree20Network.a
,libThree20Style.a
,libThree20UI.a
,libThree20UICommon.a
andlibThree20Navigator.a
. This will cause Xcode to build Three20 when you build your project.Add
${BUILD_DIR}/three20
to your include path as per Colin's answer: go to build settings, double click on "Header Search Paths", and add${BUILD_DIR}/three20
(it will show asbuild/three20
when you close the dialog).Add
three20/src/Three20.bundle
to your resources.It's probably also a good idea to add the linker flags -ObjC and -all_load if you haven't already done so (same dialog, setting "Other Linker Flags").
The steps above are good enough for compiling the code. To make "Archive" work too, you will need to:
Add
$(BUILT_PRODUCTS_DIR)/../three20
and$(BUILT_PRODUCTS_DIR)/../../three20
to the Header Search Paths setting. If you don't you will get compilation errors that the three20 headers cannot be found.For all Three20 projects (so not just the top-level project), go the Build Settings and set "Skip Install" to YES. If you don't, the project will build, but you will not be able to create an IPA.
Make sure that your product name (select your target, go to Build Settings, then setting "Product Name") does not contain spaces, otherwise archiving will not work.
Finally, if you're getting errors such as
ld: library not found for -lThree20
and you are using a custom build configuration (such as AdHoc), make sure to add the same build configuration to each of the Three20 projects too (just duplicate the Release configuration).您应该查看这个 StackOverflow 问题。
我在下面复制了已接受的答案:
You should check out this StackOverflow question.
I've reproduced the accepted answer below:
将这两个路径添加到目标的构建设置中的标头搜索路径:
“$(BUILD_DIR)/ Three20”
"$(BUILD_DIR)/../ Three20"
第一个条目用于常规构建,第二个条目用于存档。
就这么简单。
顺便说一句,要在您的主目录中创建一个文件,其中包含目标环境的所有 Xcode 环境变量的列表,请将以下运行脚本构建阶段添加到您的目标,其中包含以下内容:
环境电压> ~/xcode-environment.sh
请注意,在这种情况下,如果您的项目没有通过构建过程的编译阶段,并且您的 Run 脚本稍后出现,则该脚本将不会被执行,因此请将其放在第一位。
Add these two paths to your header search paths in the build settings for your target:
"$(BUILD_DIR)/three20"
"$(BUILD_DIR)/../three20"
The first entry is needed for regular builds and the second entry is needed for archives.
It's that easy.
Incidentally, to create a file in your home directory with a list of all of Xcode's environment variables for your target's environement, add the following Run script build phase to your target with contents:
ENV > ~/xcode-environment.sh
Note that in this case, if your project is not making it through the compile phase of the build process, and your Run script comes later, the script won't get executed, so put it first.