简体   繁体   English

iOS代码签名错误

[英]iOS Code Signing Error

I'm trying to install and run a basic iOS application on my iPhone. 我正在尝试在iPhone上安装并运行基本的iOS应用程序。 The error I am getting when I try to build and install is: 尝试构建和安装时遇到的错误是:

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. 编辑:请记住,该项目可以在不需要代码签名的模拟器上完美地进行编译,安装和运行。

请在info.plist中检查您的捆绑包标识符,如果还正确,请重新启动设备和机器,然后进行构建,并选择正确版本的SDK,它可能会起作用。

I had been having this problem each time I change to a new computer, this is my solution: 每次更换新计算机时,我都会遇到这个问题,这是我的解决方案:

  1. Go to your keychain Access, under Login | 转到“ 登录”下的“钥匙串访问”。 Certificates and delete those certificates. 证书并删除这些证书。
  2. Login on developer.apple.com 在developer.apple.com上登录
  3. Go to Provisioning Portal. 转到Provisioning Portal。
  4. Go to Certificates and REVOKE your profile. 转到证书并撤消您的个人资料。
  5. Create a new one (using the guide on site). 创建一个新的(使用现场指南)。
  6. Download and Open your new Certificate. 下载并打开您的新证书。
  7. Download and Install your Provisioning Profile. 下载并安装您的配置文件。
  8. Go to Xcode, Clean and Build. 转到Xcode,清理并生成。
  9. Assign your certificates to the code sign in sections again... 再次将您的证书分配给代码登录部分...

And voila! 瞧! That's it! 而已!

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这个术语,奇怪地表示您的应用将运行的最高版本的OS,因此,它越低,兼容的机会就越大。

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中设置捆绑包标识符。

Had some rather incomprehensible problems with CodeSign in Xcode 4 today. 今天,Xcode 4中的CodeSign存在一些相当不可理解的问题。 The problem started when I installed Xcode 4.2 beta to try and resolve some iOS 5.0 issues with my apps. 当我安装Xcode 4.2 beta来尝试解决我的应用程序的某些iOS 5.0问题时,问题就开始了。 I ended up uninstalling it and going back to Xcode 4.1 and thats when my problems started. 我最终将其卸载并返回到Xcode 4.1,这就是我的问题开始的时候。 I got the following error when building my apps: 构建我的应用程序时出现以下错误:

... 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 . 应该有一个符号链接/usr/bin/codesign_allocate It must have been deleted during an uninstall. 必须在卸载过程中将其删除。 So I ran the following to recreate it: 因此,我运行以下命令来重新创建它:

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. 希望这些信息对您有所帮助并为您节省时间。

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. 只需注销然后重新登录即可解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM