捆绑标识符在 iOS 项目中意味着什么?

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

What does bundle identifier mean in an iOS project?

ios

提问by Adam Lee

When I use command line tool template it has a bundle identifier inside the wizard. What does bundle identifier mean? Is this similar to namespace?

当我使用命令行工具模板时,它在向导中有一个包标识符。捆绑标识符是什么意思?这类似于命名空间吗?

采纳答案by FredericK

According to Apple docs:

根据苹果文档

A bundle identifier lets iOS and macOS recognize any updates to your app. Your bundle ID must be registered with Apple and be unique to your app. Bundle IDs are app-type specific (either iOS or macOS). The same bundle ID cannot be used for both iOS and macOS apps.

捆绑标识符可让 iOS 和 macOS 识别您的应用程序的任何更新。您的捆绑 ID 必须在 Apple 注册,并且对于您的应用程序是唯一的。捆绑 ID 是特定于应用程序类型的(iOS 或 macOS)。同一捆绑 ID 不能同时用于 iOS 和 macOS 应用程序。

Edit

编辑

Since Xcode 11.4, you can use same bundle identifier for both iOS and macOS app if you want to support universal purchase feature.

从 Xcode 11.4 开始,如果您想支持通用购买功能,您可以为 iOS 和 macOS 应用程序使用相同的捆绑标识符。

From Release Note

来自发行说明

Xcode 11.4 supports building and distributing macOS apps as a universal purchase. To distribute your macOS app as a universal purchase, specify the same bundle identifier as your iOS app in the Xcode template assistant when creating a new project. If you have an existing project, edit its bundle identifier in the Project Editor.

Xcode 11.4 支持构建和分发 macOS 应用程序作为通用购买。要将您的 macOS 应用程序作为通用购买分发,请在创建新项目时在 Xcode 模板助手中指定与您的 iOS 应用程序相同的包标识符。如果您有现有项目,请在项目编辑器中编辑其包标识符。

回答by CodaFi

The bundle identifier is the unique string that identifies your application to the system. This compares to the display name(namespaces are usually prefixes in frameworks), which is what iOS uses to show the name of your app on the springboard.

包标识符是向系统标识您的应用程序的唯一字符串。这与显示名称(命名空间通常是框架中的前缀)相比,这是 iOS 用来在跳板上显示您的应用程序名称的名称。

Bundle identifiers are usually (not always) written out in reverse DNS notation (I.e com.myCompany.myApp).

捆绑标识符通常(并非总是)以反向 DNS 表示法(即 com.myCompany.myApp)写出。

回答by selva

Adding more points to above answers: provisioning profile, the app's bundle ID needs to be unique and the project assigned to a team. This id can be set in app's target general tab. To create the default bundle ID, Xcode concatenates the company identifier with the product name you entered when creating the project from a template. The string format should be Uniform Type Identifier(UTI), which is alphanumeric characters (A-Z,a-z,0-9), hyphen (-), and period (.)

为上述答案添加更多要点:配置文件、应用程序包 ID 必须是唯一的以及分配给团队的项目。此 ID 可以在应用程序的目标常规选项卡中设置。为了创建默认包 ID,Xcode 将公司标识符与您在从模板创建项目时输入的产品名称连接起来。字符串格式应为统一类型标识符 (UTI),即字母数字字符 (AZ,az,0-9)、连字符 (-) 和句点 (.)