xcode iOS 代码签名错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5619874/
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
iOS Code Signing Error
提问by Jacob Lyles
I'm trying to install and run a basic iOS application on my iPhone. The error I am getting when I try to build and install is:
我正在尝试在我的 iPhone 上安装和运行一个基本的 iOS 应用程序。我尝试构建和安装时遇到的错误是:
CodeSign /Users/jacob/Library/Developer/Xcode/DerivedData/newProject-bttbyexujwyetreshrllqrqmpouw/Build/Products/Debug-iphoneos/newProject.app
cd /Users/jacob/code/iphone/newProject
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
setenv _CODESIGN_ALLOCATE_ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
/usr/bin/codesign -f -s "iPhone Developer: Jacob LYLES (P4AAK856G5)" --resource-rules=/Users/jacob/Library/Developer/Xcode/DerivedData/newProject-bttbyexujwyetreshrllqrqmpouw/Build/Products/Debug-iphoneos/newProject.app/ResourceRules.plist --entitlements /Users/jacob/Library/Developer/Xcode/DerivedData/newProject-bttbyexujwyetreshrllqrqmpouw/Build/Intermediates/newProject.build/Debug-iphoneos/newProject.build/newProject.xcent /Users/jacob/Library/Developer/Xcode/DerivedData/newProject-bttbyexujwyetreshrllqrqmpouw/Build/Products/Debug-iphoneos/newProject.app
/Users/jacob/Library/Developer/Xcode/DerivedData/newProject-bttbyexujwyetreshrllqrqmpouw/Build/Products/Debug-iphoneos/newProject.app: The operation was cancelled by the user.
Command /usr/bin/codesign failed with exit code 1
I've deleted and redownloaded all my provisioning profiles and certificates and whatnot a million times. Any help is much appreciated. I can provide more information as needed. I am using iOS 4.3 SDK on XCode 4.0.
我已经删除并重新下载了我所有的配置文件和证书以及诸如此类的一百万次。任何帮助深表感谢。我可以根据需要提供更多信息。我在 XCode 4.0 上使用 iOS 4.3 SDK。
edit: Please keep in mind that the project compiles, installs, and runs perfectly on the simulator where no code signing is needed.
编辑:请记住,该项目在不需要代码签名的模拟器上编译、安装和运行完美。
回答by Ankit Patel
please check your bundle identifier in info.plist, and if it is also correct restart both your device and machine and then made build and also select proper version of SDK, It may work.
请在 info.plist 中检查您的包标识符,如果它也正确,请重新启动您的设备和机器,然后进行构建并选择正确版本的 SDK,它可能会工作。
回答by Jorge Vicente Mendoza
I had been having this problem each time I change to a new computer, this is my solution:
每次换新电脑时都会遇到这个问题,这是我的解决方案:
- Go to your keychain Access, under Login| Certificatesand delete those certificates.
- Login on developer.apple.com
- Go to Provisioning Portal.
- Go to Certificates and REVOKE your profile.
- Create a new one (using the guide on site).
- Download and Open your new Certificate.
- Download and Install your Provisioning Profile.
- Go to Xcode, Clean and Build.
- Assign your certificates to the code sign in sections again...
- 转到您的钥匙串访问,在登录下| 证书并删除这些证书。
- 登录 developer.apple.com
- 转到配置门户。
- 转到证书并撤销您的个人资料。
- 创建一个新的(使用现场指南)。
- 下载并打开您的新证书。
- 下载并安装您的配置文件。
- 转到 Xcode,清理和构建。
- 再次将您的证书分配给代码登录部分...
And voila! That's it!
瞧!就是这样!
回答by IPhoneDev
Had some rather incomprehensible problems with CodeSign in Xcode 4 today. The problem started when I installed Xcode 4.2 beta to try and resolve some iOS 5.0 issues with my apps. I ended up uninstalling it and going back to Xcode 4.1 and thats when my problems started. I got the following error when building my apps:
今天在 Xcode 4 中使用 CodeSign 遇到了一些相当难以理解的问题。当我安装 Xcode 4.2 beta 以尝试解决我的应用程序的一些 iOS 5.0 问题时,问题就开始了。我最终卸载了它并返回到 Xcode 4.1,这就是我的问题开始的时候。构建应用程序时出现以下错误:
... object file format invalid or unsuitable
Command /usr/bin/codesign failed with exit code 1
... 目标文件格式无效或不合适
命令 /usr/bin/codesign 失败,退出代码为 1
I tried everything, re-downloading certificates, provisioning profiles, code signing build settings, the lot. Nothing seemed to help. A lot of googling revealed no definitive answer.
我尝试了一切,重新下载证书、配置文件、代码签名构建设置等等。似乎没有任何帮助。很多谷歌搜索都没有给出明确的答案。
In the end it turned out to be something quite obscure. There is supposed to be a symlink /usr/bin/codesign_allocate
. It must have been deleted during an uninstall. So I ran the following to recreate it:
最后发现这是一件相当晦涩的事情。应该有一个符号链接/usr/bin/codesign_allocate
。它必须在卸载过程中被删除。所以我运行以下命令来重新创建它:
sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate /usr/bin
Xcode, clean and build and everything was fine.
Xcode,干净和构建,一切都很好。
Hope this information proves useful and saves you time.
希望这些信息证明有用并节省您的时间。
回答by Justin Kent
Another thing that causes this error is changing your login keychain password. Maybe you work at a place that forces you to change your password every so often. Next time you do so, you could possibly start getting this error. Simply logging out then back in will fix it.
导致此错误的另一件事是更改您的登录钥匙串密码。也许您在一个强迫您经常更改密码的地方工作。下次这样做时,您可能会开始收到此错误。只需注销然后重新登录即可解决。
回答by Anthony
Have you checked your deployment target? Alot of people confuse the term Base SDK strangely represents the highest version of OS your app will run on, therefor, the lower it is, the greater the chances of compatibility are.
您是否检查过部署目标?很多人混淆了术语 Base SDK 奇怪地代表您的应用程序将运行的最高版本的操作系统,因此,它越低,兼容性的机会就越大。
回答by Ishu
Use your provisioning profile for build. set it in info of project as well as in target (get info + build tab + code signing identity)and also set bundle identifier in yourApp-Info.pList.
使用您的配置文件进行构建。在项目信息和目标信息中设置它(获取信息 + 构建选项卡 + 代码签名标识),并在 yourApp-Info.pList 中设置包标识符。