xcode 为企业分发创建 IPA 文件时出错:“PackageApplication failed with exit code 1”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6969566/
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
Error Creating IPA File for Enterprise Distribution: "PackageApplication failed with exit code 1"
提问by Brad
I am running XCode 4.2 and when I Build, Archive, and then attempt to create the IPA file in Organizer, I get the following error message:
我正在运行 XCode 4.2,当我构建、存档,然后尝试在 Organizer 中创建 IPA 文件时,我收到以下错误消息:
PackageApplication failed with exit code 1.
Packaging application: '/Users/Brad/Library/Developer/Xcode/Archives/2011-08-06/*** 8-6-11 4.21 PM.xcarchive/Products/Applications/***.app'
Arguments: embed=/Users/Brad/Library/MobileDevice/Provisioning Profiles/***.mobileprovision verbose=1 output=/var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/1376A091-5CA1-4393-AF29-34FFBFD49C74-1082-00000C64DB251DF1/app.ipa sign=iPhone Distribution: ***.
Environment variables:
HOME = /Users/Brad
LOGNAME = Brad
__CF_USER_TEXT_ENCODING = 0x1F5:0:0
DISPLAY = /tmp/launch-r5c1Ou/org.x:0
COMMAND_MODE = unix2003
VERSIONER_PERL_PREFER_32_BIT = no
PATH = /Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
SHELL = /bin/bash
SSH_AUTH_SOCK = /tmp/launch-SjRZET/Listeners
Apple_PubSub_Socket_Render = /tmp/launch-4KUyaU/Render
TMPDIR = /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/
USER = Brad
VERSIONER_PERL_VERSION = 5.10.0
Output directory: '/var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/1376A091-5CA1-4393-AF29-34FFBFD49C74-1082-00000C64DB251DF1/app.ipa'
Temporary Directory: '/var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U' (will NOT be deleted on exit when verbose set)
+ /bin/cp -Rp /Users/Brad/Library/Developer/Xcode/Archives/2011-08-06/*** 8-6-11 4.21 PM.xcarchive/Products/Applications/***.app /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload
Program /bin/cp returned 0 : []
### Checking original app
+ /usr/bin/codesign --verify -vvvv /Users/Brad/Library/Developer/Xcode/Archives/2011-08-06/*** 8-6-11 4.21 PM.xcarchive/Products/Applications/***.app
Program /usr/bin/codesign returned 0 : [/Users/Brad/Library/Developer/Xcode/Archives/2011-08-06/*** 8-6-11 4.21 PM.xcarchive/Products/Applications/***.app: valid on disk
/Users/Brad/Library/Developer/Xcode/Archives/2011-08-06/*** 8-6-11 4.21 PM.xcarchive/Products/Applications/***.app: satisfies its Designated Requirement
]
Done checking the original app
### Embedding '/Users/Brad/Library/MobileDevice/Provisioning Profiles/***.mobileprovision'
+ /bin/rm -rf /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload/***.app/embedded.mobileprovision
Program /bin/rm returned 0 : []
+ /bin/cp -rp /Users/Brad/Library/MobileDevice/Provisioning Profiles/***.mobileprovision /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload/***.app/embedded.mobileprovision
Program /bin/cp returned 0 : []
+ /usr/bin/codesign -d --entitlements /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/entitlements_rawunFQiwaj /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload/***.app
Program /usr/bin/codesign returned 0 : [Executable=/var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload/***.app/***
]
+ /usr/libexec/PlistBuddy -c Set :get-task-allow NO /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/entitlements_plistNowUyBmz
Program /usr/libexec/PlistBuddy returned 0 : []
+ /usr/bin/plutil -lint /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/entitlements_plistNowUyBmz
Program /usr/bin/plutil returned 0 : [/var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/entitlements_plistNowUyBmz: OK
]
### Codesigning '/Users/Brad/Library/MobileDevice/Provisioning Profiles/***.mobileprovision' with 'iPhone Distribution: ***.'
+ /usr/bin/codesign --force --preserve-metadata --sign iPhone Distribution: ***. --resource-rules=/var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload/***.app/ResourceRules.plist --entitlements /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/entitlements_plistNowUyBmz /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload/***.app
Program /usr/bin/codesign returned 1 : [/var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload/***.app: replacing existing signature
codesign_allocate: object: /var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload/***.app/*** malformed object (unknown load command 8)
/var/folders/-K/-K95TJ0AGgaHq4MSn8EjL++++TI/-Tmp-/kNwZk2Uc3U/Payload/***.app: object file format invalid or unsuitable
]
error: codesign failed with error 1
Note: I replaced any names with *.
注意:我用*替换了所有名称。
回答by ZeroDiv
There is no single answer to this problem, partly because Apple's error message(s) is/are not terribly specific.
这个问题没有单一的答案,部分原因是 Apple 的错误消息不是非常具体。
For my case the solution was this:
对于我的情况,解决方案是这样的:
Open this Perl script:
打开这个 Perl 脚本:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication
and insert this line near the top, like right after the "my $xxxx" declarations:
并在顶部附近插入这一行,就像在“my $xxxx”声明之后一样:
$ENV{CODESIGN_ALLOCATE} = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate';
Credit to http://loopingrecursion.com/index.php?t=codesignfor this answer.
感谢http://loopingrecursion.com/index.php?t=codesign这个答案。
The problem seemed to arise after installing some XCode 4.2 beta 7. I eventually uninstalled that one and reinstalled 4.1 from scratch but still couldn't Validate or Share, until I employed this fix.
这个问题似乎是在安装了一些 XCode 4.2 beta 7 之后出现的。我最终卸载了那个并从头开始重新安装了 4.1,但仍然无法验证或共享,直到我使用了这个修复程序。
回答by RuudPuts
Ran into this myself a few minutes ago.
几分钟前我自己遇到了这个。
Make sure you have a Distribution Certificate in your keychain (you can create one in your Provisioning Portal), and also a Distribution Profile (also you can create this in you Provisioning Portal).
确保你的钥匙串中有一个分发证书(你可以在你的供应门户中创建一个),还有一个分发配置文件(你也可以在你的供应门户中创建它)。
After that, go into your Project properties, to the 'Build Settings' tab. You'll find a section called 'Code Signing', and at the 'Code Signing Identity' part, at 'Release' you select 'iPhone Distribution'.
之后,进入您的项目属性,到“构建设置”选项卡。您会找到一个名为“代码签名”的部分,在“代码签名身份”部分,在“发布”中选择“iPhone 分发”。
That was how i fixed it,
我就是这样修的
Good luck!
祝你好运!
EDIT: just saw you're in the Enterprise program, i'm not sure if my solution works for Enterprise..
编辑:刚刚看到您加入了企业计划,我不确定我的解决方案是否适用于企业。
回答by tom_g_
The "PackageApplication failed with exit code 1." error during archiving can also be caused by a missing resource. Check your error message for which resource it can't find.
“PackageApplication 失败,退出代码为 1。” 存档期间的错误也可能是由于缺少资源造成的。检查您的错误消息,了解它找不到哪个资源。
回答by ribeto
Just to put my 5 cents on this. I had the same error and it turned out that I had 2 Distribution certificates in my keychain. One of them appeared with a red X next to it. After deleting it the error was resolved.
只是为了把我的 5 美分放在这上面。我遇到了同样的错误,结果我的钥匙串中有 2 个分发证书。其中一个出现,旁边有一个红色的 X。删除后,错误得到解决。