Xcode 4 & Three20 & create IPA archive:没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5261447/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:26:08  来源:igfitidea点击:

Xcode 4 & three20 & create IPA archive: No such file or directory

iphonexcodethree20xcode4

提问by Manni

In Xcode 3.2.5 I use "Build And Archive" to create an IPA file without any problems. How can I do that in Xcode 4? I think I have to use "Product -> Archive", but I get over 100 error messages in the three20 framework. Most are "No such file or directory". ("Product -> Build For -> Build For Archiving" works. No errors.)

在 Xcode 3.2.5 中,我使用“Build And Archive”创建 IPA 文件,没有任何问题。我怎样才能在 Xcode 4 中做到这一点?我想我必须使用“产品 - > 存档”,但是我在 Three20 框架中收到了 100 多条错误消息。大多数是“没有这样的文件或目录”。(“产品 -> 构建 -> 为归档构建”有效。没有错误。)

For example, this is the first error message:

例如,这是第一条错误消息:

../scripts/Protect.command: line 23: cd: /Users/[USERNAME]/Library/Developer/Xcode/DerivedData/[PROJECTNAME]-blabla/ArchiveIntermediates/[PROJECTNAME]/BuildProductsPath/Release-iphoneos/../three20/Three20Core: No such file or directory

The path "/[PROJECTNAME]/BuildProductsPath/three20/"really doesn't exists, but this path exists: "/[PROJECTNAME]/three20/"

该路径"/[PROJECTNAME]/BuildProductsPath/three20/"确实不存在,但此路径存在:"/[PROJECTNAME]/three20/"

What can I do?

我能做什么?

回答by Amir Naor

The Three20 documentation did not solve this issue for me (unfortunately...). Eventually what worked for me was a mix of a few solutions. There is a difference between "Archive" and "Build for Archiving" (or build for run) and using these steps I have both of them working with no build issues:

Three20 文档没有为我解决这个问题(不幸的是......)。最终对我有用的是几种解决方案的混合。“存档”和“为存档而构建”(或为运行而构建)之间存在差异,并且使用这些步骤我让它们都可以在没有构建问题的情况下工作:

You will need to change the scripts as Manni mentioned, set the "Skip Install" flag for each Three20 project linked to your project tree and add the following paths to your project's "Header search paths":

您将需要更改Manni 提到的脚本,为链接到项目树的每个 Three20 项目设置“跳过安装”标志,并将以下路径添加到项目的“标题搜索路径”:

"$(BUILT_PRODUCTS_DIR)/../three20" "$(BUILT_PRODUCTS_DIR)/../../three20"

"$(BUILT_PRODUCTS_DIR)/../three20" "$(BUILT_PRODUCTS_DIR)/../../three20"

this will get you to work with the Build option. When you want to perform the archive action, then you will also need to change the "Locations" preference in Xcode as featherless mentioned above.

这将使您能够使用“构建”选项。当您想要执行存档操作时,您还需要将 Xcode 中的“位置”首选项更改为上面提到的无羽化

I documented these steps in this post.

我在这篇文章中记录了这些步骤。

回答by Manni

Configuration that works both for build and archive in Xcode4.
https://github.com/pazustep/three20/commit/4a9aad4eb90a6962dd729d245f9293a7cc0d7f36

适用于 Xcode4 中的构建和存档的配置。
https://github.com/pazustep/three20/commit/4a9aad4eb90a6962dd729d245f9293a7cc0d7f36



src/common/Configurations/Paths.xcconfig

src/common/Configurations/Paths.xcconfig

REPO_ROOT_PATH    = $(SRCROOT)/../..
ROOT_SOURCE_PATH  = $(REPO_ROOT_PATH)/src

//OBJROOT = $(REPO_ROOT_PATH)/Build
//SYMROOT = $(OBJROOT)/Products

// Search Paths

LIBRARY_SEARCH_PATHS    = $(STDLIB_LIBRARY)
//HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) "$(CONFIGURATION_BUILD_DIR)/../three20"
HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) "$(BUILT_PRODUCTS_DIR)/../three20" "$(BUILT_PRODUCTS_DIR)/../../three20"

src/scripts/Protect.command

src/脚本/Protect.command

# Ignore whitespace characters in paths
IFS=$'\n'

#cd ${CONFIGURATION_BUILD_DIR}${PUBLIC_HEADERS_FOLDER_PATH}

if [ "${DEPLOYMENT_LOCATION}" == "YES" ]; then
    PREFIX=${BUILT_PRODUCTS_DIR}/..
else
    PREFIX=${BUILT_PRODUCTS_DIR}
fi

cd ${PREFIX}${PUBLIC_HEADERS_FOLDER_PATH}

chmod a-w *.h 2>> /dev/null
chmod a-w private/*.h 2>> /dev/null

exit 0

回答by jverdi

Another thing that could throw off the build process is using a scheme namethat contains spaces.

另一个可能会中断构建过程的事情是使用包含空格方案名称

XCode won't stop you from doing it, but if you use a name like "Ad Hoc" for your scheme, you'll end up the same errors:

XCode 不会阻止你这样做,但如果你为你的方案使用像“Ad Hoc”这样的名字,你最终会得到同样的错误:

Three20/Three20+Additions.h: No such file or directory

回答by featherless

I'm looking into this right now and will hopefully put together an adequate patch that works in both Xcode 3.2.# and Xcode 4.

我现在正在研究这个问题,并希望能提供一个适用于 Xcode 3.2.# 和 Xcode 4 的适当补丁。

Edit: So it looks like the easiest way to get old Xcode 3.2 projects to work with Xcode 4 is to do the following:

编辑:所以看起来让旧的 Xcode 3.2 项目与 Xcode 4 一起工作的最简单方法是执行以下操作:

  • Go into Xcode 4's preferences (Cmd+,).
  • Select the "Locations" tab.
  • Where it says "Build Locations", select the drop down and pick "Place build products in locations specified by targets"
  • 进入 Xcode 4 的首选项 (Cmd+,)。
  • 选择“位置”选项卡。
  • 在显示“构建位置”的地方,选择下拉菜单并选择“将构建产品放置在目标指定的位置”

I'll write up a three20.info article going into more details about this.

我会写一篇three20.info 文章来详细介绍这方面的内容。

回答by Manni

three20.info: Xcode 4 Transition Guide
http://three20.info/article/2011-03-10-Xcode4-Support

Three20.info:Xcode 4 转换指南
http://three20.info/article/2011-03-10-Xcode4-Support

This guide has been put together by the Three20 team in order to help you migrate your apps to Xcode 4 successfully.

本指南由 Three20 团队编写,旨在帮助您将应用程序成功迁移到 Xcode 4。

回答by Martin Reichl

Make sure your scheme name doesn't contains spaces. That also leads to the "File not found" build error.

确保您的方案名称不包含空格。这也会导致“找不到文件”构建错误。

回答by Banjer

I had to go under Project Info > Build (tab) and add the following to the header search path:

我必须进入 Project Info > Build (tab) 并将以下内容添加到标题搜索路径中:

three20/Build/Products/three20

This path may be specific to my project, but there it is in case it works for someone else.

此路径可能特定于我的项目,但如果它适用于其他人,则可以使用它。

回答by abbood

I did the following to make it work for me:

我做了以下工作以使其对我有用:

  1. for the three20 static library, I used cocoapodsto include the files within the main project.. it just got rid of all the trouble three20 was giving me (and they are lots..) btw i tried replacing three20 with Nimbus.. but Nimbus was lacking on some of the features that my project was using three20 for.. so Nimbus wasn't helpful.
  2. set skip install to yes under build settings for all other sub projects/static libraries and switched the copy headers from public to project under build phases
  3. most importantly:under the sub libraries.. under build phases i ensured that copy filesdestination was changed from Absolute pathto products directory.
  1. 对于three20静态库,我使用cocoapods将文件包含在主项目中..它摆脱了three20给我带来的所有麻烦(而且它们很多..)顺便说一句,我尝试用Nimbus替换three20 ..但是Nimbus缺少我的项目使用 Three20 的一些功能......所以 Nimbus 没有帮助。
  2. 在所有其他子项目/静态库的构建设置下将 skip install 设置为 yes 并在构建阶段将复制头从 public 切换到项目
  3. 最重要的是:在子库下.. 在构建阶段下,我确保复制文件的目的地从 更改Absolute pathproducts directory.

and that was it!

就是这样!

hint:to get an idea of the offending files that's causing your archive to create an archive file rather than an ipa do this:

提示:要了解导致存档创建存档文件而不是 ipa 的违规文件,请执行以下操作:

  1. Select the archive and click the Distribute button.
  2. Select the 'Save Built Products' option.
  3. Hit Next and Save.
  4. Browse the created directory in Finder.
  5. The 'libraries' subdirectory will identify the libraries that you need to set the Skip Install to Yes.
  6. in some cases usr/local/includewill identify the culprit header files you need to move from Public to Project or the files that you have to change from absolute path to products directory. but that directory (ie usr/local/include) varies depending on your sublibrary directory structure
  1. 选择存档并单击分发按钮。
  2. 选择“保存构建的产品”选项。
  3. 点击下一步并保存。
  4. 在 Finder 中浏览创建的目录。
  5. 'libraries' 子目录将标识您需要将跳过安装设置为是的库。
  6. 在某些情况下,usr/local/include将确定您需要从 Public 移动到 Project 或您必须从绝对路径更改为 products 目录的罪魁祸首头文件。但该目录(即 usr/local/include)因您的子库目录结构而异

回答by tar500

If you want a quick workaround, just do next simple steps:

1. go to the mentioned /Users/[USERNAME]/Library/Developer/Xcode/DerivedData/[PROJECTNAME]-blabla/ArchiveIntermediates/[PROJECTNAME]/BuildProductsPath/path (it will be in your error message). It should be a substring till /..in that path.
2. create Release-iphoneos(or Debug-iphoneosif appropriate) folder there

如果您想要快速解决方法,只需执行以下简单步骤:

1. 转到提到的/Users/[USERNAME]/Library/Developer/Xcode/DerivedData/[PROJECTNAME]-blabla/ArchiveIntermediates/[PROJECTNAME]/BuildProductsPath/路径(它将在您的错误消息中)。它应该是/..该路径中的子字符串。
2.在那里创建Release-iphoneos(或Debug-iphoneos如果合适)文件夹

Then everything will build fine!

然后一切都会好起来的!

Three20 script assumes you already have that folder, but when you build first time there is no one exists. That's why you need to fix "Build" and "Archive" separately: "Build" action usually uses Debug-iphoneosfolder and "Archive" action uses Release-iphoneos.

Three20 脚本假设您已经拥有该文件夹,但是当您第一次构建时,该文件夹不存在。这就是为什么您需要分别修复“构建”和“存档”的原因:“构建”操作通常使用Debug-iphoneos文件夹,而“存档”操作使用Release-iphoneos.

Tip:you can create all the required folders at once to avoid problems with different configurations. These are:
Release-iphoneos
Debug-iphoneos
Release-iphonesimulator
Debug-iphonesimulator

提示:您可以一次创建所有必需的文件夹,以避免不同配置出现问题。这些是:
Release-iphoneos
Debug-iphoneos
Release-iphonesimulator
Debug-iphonesimulator

回答by Manni

Open the file /src/common/Configurations/Paths.xcconfig

打开文件 /src/common/Configurations/Paths.xcconfig

old code:

旧代码:

HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) "$(CONFIGURATION_BUILD_DIR)/../three20"

new code:

新代码:

HEADER_SEARCH_PATHS     = $(STDLIB_HEADERS) "$(CONFIGURATION_BUILD_DIR)/../../three20"

So, I still have 7 errors, but I can create the archive...

所以,我仍然有 7 个错误,但我可以创建存档...