xcode 此应用程序的包标识符与其代码签名标识符不匹配
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34642165/
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
This application's bundle identifier does not match its code signing identifier
提问by Vojtech Vrbka
When I try to build and run the app on the device I get following error App installation failed: This application's bundle identifier does not match its code signing identifier.
当我尝试在设备上构建和运行应用程序时,出现以下错误 App installation failed: This application's bundle identifier does not match its code signing identifier.
I checked the signing certificates, bundle ids, provision profile, entitlements and everything is correct.
我检查了签名证书、捆绑 ID、配置文件、权利,一切都是正确的。
Any Ideas ?
有任何想法吗 ?
采纳答案by Vojtech Vrbka
回答by Douglas Silva
- Go into
Building Phases
- Click the
+
sing and add script inNew Run Script Phase
- Add
/usr/local/bin/carthage copy-frameworks
to the script box. - In
Input Files
add a line for each Carthage framework you're using in your app:$(SRCROOT)/Carthage/Build/iOS/FrameworkName.framework
- If you're still having problems, also add this under
Output Files
for each framework:$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/FrameworkName.framework
- 进入
Building Phases
- 单击
+
唱歌并添加脚本New Run Script Phase
- 添加
/usr/local/bin/carthage copy-frameworks
到脚本框。 - 在
Input Files
添加一条线,你正在使用你的应用程序的每个迦太基框架:$(SRCROOT)/Carthage/Build/iOS/FrameworkName.framework
- 如果您仍然遇到问题,还可
Output Files
以为每个框架添加以下内容:$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/FrameworkName.framework
This process fixed it for me. It can be found under Carthage documentation. You can see this process here in items 4, 5, 6. https://github.com/Carthage/Carthage#adding-frameworks-to-an-application
这个过程为我修复了它。它可以在 Carthage 文档下找到。您可以在第 4、5、6 项中看到此过程。 https://github.com/Carthage/Carthage#adding-frameworks-to-an-application
回答by Oleksii Nezhyborets
To fix this, I had to set framework's Product Bundle Identifierto anything with a dot.
为了解决这个问题,我必须将框架的 Product Bundle Identifier 设置为带有点的任何内容。
In my case it was because of framework, not Carthage's, but the one as target dependency in Workspace.
就我而言,这是因为框架,而不是 Carthage 的,而是工作区中作为目标依赖项的框架。
Before the fix Product Bundle Identifier was something like "FrameworkName", andXcode would automatically append some autogenerated ID, and Signing Identifier would become "FrameworkName-5555494493d11a8e5f473d1cb2a5d781973d171e".
在修复之前,产品包标识符类似于“FrameworkName”,Xcode 会自动附加一些自动生成的 ID,而签名标识符将变为“FrameworkName-5555494493d11a8e5f473d1cb2a5d781973d171e”。
When I set Product Bundle Identifier to something with dot, like "com.organization.frameworkName", Xcode stopped to auto-append anything, and everything works because ids match.
当我将 Product Bundle Identifier 设置为带有点的内容时,例如“com.organization.frameworkName”,Xcode 停止自动附加任何内容,并且一切正常,因为 id 匹配。
It seems that it wasn't an issue before Xcode 11 and Catalina. This debug was crazy.
在 Xcode 11 和 Catalina 之前,这似乎不是问题。这个调试很疯狂。
回答by Teja Kumar Bethina
This issue is only related to CODE SIGNING
此问题仅与CODE SIGNING相关
But, the key point to note here is, if you are using XCode 11.x version. Not only the code signing in your project, but we should check the code signing in Thirdparty SDKs or dependencies that we add to our project.
但是,这里要注意的关键点是,如果您使用的是 XCode 11.x 版本。不仅是项目中的代码签名,我们还应该检查我们添加到项目中的第三方 SDK 或依赖项中的代码签名。
Steps to verify the Code Signing of 3rd party SDks:
验证第 3 方 SDks 代码签名的步骤:
- Download the source code of framework you need
- Open the .xcproj file from the source code using XCode 11.x
Go to Targets -> Signing & Capabilities -> Select all tab -> Bundle Identifier If you see any unevenness in the identifier like, identifier with 4 seperators (Eg: com.company.mac.app)
Change it to com.*and enter.
Make sure your XCODE COMMAND LINE TOOLS is set with XCode 11.x
Now, use below command to rebuild the SDK, with the changes done in above step-3
carthage build --no-skip-current --cache-builds --platform iOS
Now copy the framework generated from, carthagefolder of source code, and replace the existing SDK in your project.
- 下载你需要的框架源码
- 使用 XCode 11.x 从源代码打开 .xcproj 文件
转到目标 -> 签名和功能 -> 选择所有选项卡 -> 捆绑标识符如果您看到标识符中有任何不均匀,例如带有 4 个分隔符的标识符(例如:com.company.mac.app)
将其更改为com.*并输入。
确保您的 XCODE COMMAND LINE TOOLS 设置为 XCode 11.x
现在,使用下面的命令重建 SDK,在上面的第 3 步中完成更改
carthage build --no-skip-current --cache-builds --platform iOS
现在复制源代码的carthage文件夹中生成的框架,并替换项目中现有的 SDK。
Repeat the same for process for all the 3rd party SDKs, in your project.
对项目中的所有 3rd 方 SDK 重复相同的过程。
NOTE:Make sure you marked all the 3rd party SDKs as Embed & Signin
注:请务必标明所有的第三方软件开发工具包为嵌入和登录在
Targets => General => Frameworks, Libraries, and Embedded Content
回答by Bassant Ashraf
in iTunes they changed it to have a flag for each role if he will have Access to Certificates, Identifiers & Profiles. and by default its false.
在 iTunes 中,如果他有权访问证书、标识符和配置文件,他们将其更改为每个角色都有一个标志。默认情况下它是假的。
All i had to do is to:
我所要做的就是:
go to iTunesConnect -> Users and Access -> edit my role by checking the box of "Access to Certificates, Identifiers & Profiles"
转到 iTunesConnect -> 用户和访问 -> 通过选中“访问证书、标识符和配置文件”框来编辑我的角色
回答by Adrian Sluyters
Are you using custom .xcconfig
files?
您是否使用自定义.xcconfig
文件?
Sometimes custom .xccofigs can override the default code-sign settings.
有时自定义 .xccofigs 可以覆盖默认的代码签名设置。
1) See if the project has a custom config by:
--- 1) Click on project
whatever the project name is called in Xcode (usually at the top)
1)通过以下方式查看项目是否具有自定义配置:--- 1)单击project
Xcode中调用的任何项目名称(通常在顶部)
2) On the right you'll see your project settings. In here, you can set the identifier.. If not, then you're on the wrong view. This is what you should see:
2) 在右边你会看到你的项目设置。在这里,您可以设置标识符。如果没有,那么您就错了。这是你应该看到的:
3) Change the "bundle Identifier" to something to the effect of "com.yourcompany.yourAppName". --- The com.yourcompany is your website domain name reversed.. Apple Recommend this. --- After the com.yourcompany is the app name or "nickname' your give it so. com.yourcompany.myCoolApp would be the full identifier.
3) 将“bundle Identifier”更改为“com.yourcompany.yourAppName”的效果。--- com.yourcompany 是你的网站域名反了.. Apple 推荐这个。--- 在 com.yourcompany 之后是应用程序名称或“昵称”,你给它这样。com.yourcompany.myCoolApp 将是完整的标识符。
4) Once you've done this, make sure that under the "Build Settings" as below:
4)完成此操作后,请确保在“构建设置”下,如下所示:
--- That your "Code Signing Identity" is set to whatever Identity you want. For Debugging on iOS or OSX you use "iPhone Developer: Your Name xxx" or "Mac Developer: Your Name xxx".
--- 您的“代码签名身份”设置为您想要的任何身份。对于 iOS 或 OSX 上的调试,您可以使用“iPhone 开发人员:您的姓名 xxx”或“Mac 开发人员:您的姓名 xxx”。
- Code signing resources path: reserved for advanced / command line tools
- Other Code Signing Flags: Not sure, never had to use this
- Provisioning Profile: IDEALLY set this to "Automatic" so Xcode handles the setting. Otherwise, when you've set a provisioning profile on the Member Centre, then specify it here (make sure you've installed it first though).
- 代码签名资源路径:为高级/命令行工具保留
- 其他代码签名标志:不确定,从未使用过
- 配置文件:理想情况下将其设置为“自动”,以便 Xcode 处理设置。否则,当您在会员中心设置配置文件时,请在此处指定它(但请确保您已先安装它)。
回答by Vinod Vishwanath
Your app is signed by a Provisioning Profile, which in turn is linked to a Certificate (which can be either for development or distribution).
您的应用程序由供应配置文件签名,该配置文件又链接到证书(可以用于开发或分发)。
Now certificates have a Bundle ID, which can be:
现在证书有一个 Bundle ID,它可以是:
- A wildcard, such as "com.mydomain.*" OR
- An explicit ID, such as "com.mydomain.myapp"
- 通配符,例如“com.mydomain.*”或
- 显式 ID,例如“com.mydomain.myapp”
Either way, the bundle identifier of your app has to match the Bundle ID of the certificate tied to your provisioning profile. A mismatch would trigger the error you're encountering.
无论哪种方式,您的应用程序的捆绑标识符都必须与绑定到您的配置文件的证书的捆绑 ID 相匹配。不匹配会触发您遇到的错误。