xcode 从哪里获取应用程序的标识符?

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

Where does xcode take application's Identifier from?

iphonexcodeprovisioning

提问by Burjua

I think my head soon explode. I've been working on my application for some time and finally git an iPhone for testing on device, now I'm trying to run my app on iphone but can't do it. I've done all necessary steps but getting an error [BEROR]Code Sign error: a valid provisioning profile matching the application's Identifier 'com.yourcompany.MyProject' could not be found

我想我的头很快就会爆炸。我已经在我的应用程序上工作了一段时间,最后 git 一个 iPhone 用于在设备上进行测试,现在我试图在 iphone 上运行我的应用程序,但无法做到。我已完成所有必要的步骤,但出现错误 [BEROR]Code Sign error: a valid provisioning profile matching the application's Identifier 'com.yourcompany.MyProject' could not be found

My provisionign profile is called XXXXXXXXX.com.myname.*

我的配置文件被称为 XXXXXXXXX.com.myname.*

in info.plist I changed Bundle identifier to com.myname.myapplication

在 info.plist 中,我将捆绑标识符更改为 com.myname.myapplication

my project name is MyProject because I can't change it, but my target and executables called myapplication

我的项目名称是 MyProject 因为我无法更改它,但我的目标和可执行文件称为 myapplication

I've checked all setting and can't even find this yourcompanyanywhere

我已经检查了所有设置,甚至在yourcompany任何地方都找不到

but still getting this error

但仍然收到此错误

where need I seek?

我需要去哪里寻找?

thank you

谢谢你

回答by Nikolai Ruhe

Xcode uses the bundle identifier found in the target's Info.plist file for code signing.

Xcode 使用在目标的 Info.plist 文件中找到的包标识符进行代码签名。

Which Info.plist file is selected is actually a build setting (normally in the target), and is usually set up by Xcode correctly. If you manually edited the Info.plist's bundle identifier value to your identifier, Xcode should use this identifier and code signing should work.

选择哪个 Info.plist 文件实际上是一个构建设置(通常在目标中),通常由 Xcode 正确设置。如果您手动将 Info.plist 的包标识符值编辑为您的标识符,Xcode 应该使用这个标识符并且代码签名应该可以工作。

The default Info.plist file contains a bundle identifier that contains Xcode build settings and is processed to the final identifier when building the target.

默认的 Info.plist 文件包含一个包含 Xcode 构建设置的包标识符,并在构建目标时处理为最终标识符。

回答by auspicious99

The answer by Nikolai Ruhe said "If you manually edited the Info.plist's bundle identifier value to your identifier, Xcode should use this identifier and code signing should work." This is true. However, these days (I'm not sure how it was in Sep 2010), xcode uses a default bundle identifier that is a function of the variable ${PRODUCT_NAME}. This same variable is used in various other places, e.g., as bundle name, bundle display name, etc. Thus, I would recommend changing ${PRODUCT_NAME} instead, and this change will then propagate to the Info.plist's bundle identifier, etc.

Nikolai Ruhe 的回答说:“如果您手动将 Info.plist 的包标识符值编辑为您的标识符,Xcode 应该使用这个标识符并且代码签名应该可以工作。” 这是真的。但是,最近(我不确定 2010 年 9 月的情况),xcode 使用默认包标识符,该标识符是变量 ${PRODUCT_NAME} 的函数。这个相同的变量在其他各种地方使用,例如,作为包名称、包显示名称等。因此,我建议改为更改 ${PRODUCT_NAME},然后此更改将传播到 Info.plist 的包标识符等。

How to change ${PRODUCT_NAME}? Select the appropriate target, go to "build settings", expand the "packaging" section, and then edit the value of "Product name".

如何更改 ${PRODUCT_NAME}?选择合适的目标,进入“构建设置”,展开“打包”部分,然后编辑“产品名称”的值。

回答by Kunal Khanna

Select your target, go to summary. Change bundle identifier to com.myname.myapplication from com.yourcompany.MyProject. It should work! I have been using it like this and it works great everytime. You can do the same from info.plist file as well.

选择您的目标,转到摘要。将包标识符从 com.yourcompany.MyProject 更改为 com.myname.myapplication。它应该工作!我一直这样使用它,而且每次都很好用。您也可以从 info.plist 文件中执行相同操作。