macos CFBundleSignature 和 CFBundleIdentifier 的命名约定

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

Naming convention for CFBundleSignature and CFBundleIdentifier

macoscfbundleidentifier

提问by Mike2012

I am wondering how do I know what name I should give for my CFBundleSignature and CFBundleIdentifier. I believe these are supposed to be unique identifier so do I have to somehow get these names from apple? Say my app is called javaapp and comes from the website javaapp. Should my CFBundleIdentifier be com.javaapp.javaapp? What 4 letters should I use for my CFBundleSignature?

我想知道我怎么知道我应该为我的 CFBundleSignature 和 CFBundleIdentifier 取什么名字。我相信这些应该是唯一标识符,所以我必须以某种方式从苹果获取这些名称吗?假设我的应用程序名为 javaapp,来自网站 javaapp。我的 CFBundleIdentifier 应该是 com.javaapp.javaapp 吗?我的 CFBundleSignature 应该使用哪 4 个字母?

回答by Darren

The Bundle Identifier uniquely identifies your application. If you have registered a domain name, use that. Otherwise, just use com.<your name>.<application name>

Bundle Identifier 唯一标识您的应用程序。如果您已注册域名,请使用该域名。否则,只需使用com.<your name>.<application name>

The Bundle Signature is analogous to the "Creator Code" found in Classic Mac OS. It exists only for compatibility with Classic Mac OS apps and documents. Modern Mac OS X apps don't need to worry about assigning a Bundle Signature.

捆绑签名类似于经典 Mac OS 中的“创建者代码”。它的存在只是为了与经典 Mac OS 应用程序和文档兼容。现代 Mac OS X 应用程序无需担心分配捆绑签名。

回答by JWWalker

Yes, assuming that you own the domain name javaapp.com, com.javaapp.javaapp would be fine as a bundle ID. There are some rules; as I recall, the bundle ID parts can only contain letters, digits, and hyphens.

是的,假设您拥有域名 javaapp.com,com.javaapp.javaapp 作为捆绑 ID 就可以了。有一些规则;我记得,捆绑 ID 部分只能包含字母、数字和连字符。

The bundle signature in new Xcode projects is initialized as ????. You can probably leave it at that, but if you want your own code, you need to register it: http://developer.apple.com/datatype/index.html

新 Xcode 项目中的 bundle 签名被初始化为 ????。您可以保留它,但是如果您想要自己的代码,则需要注册它:http: //developer.apple.com/datatype/index.html