我可以用给定名称“SomeKey”定义一个用户定义的键,我可以使用 [[NSBundle mainBundle] objectForInfoDictionaryKey"SomeKey"]
当然!
Apple 文档:
Custom Keys
iOS and macOS ignore custom keys you include in an Info.plist file. If you want to include app-specific configuration information in your Info.plist file, you can do so freely as long as your key names do not conflict with the ones Apple uses. When defining custom key names, prefix them with a unique prefix, such as your app’s bundle ID or your company’s domain name, to prevent conflicts.
您可以通过执行以下操作来获得值(value):
Objective-C
[[NSBundle mainBundle].infoDictionary objectForKey"SomeKey"];
或
[[NSBundle mainBundle] objectForInfoDictionaryKey"SomeKey"];
swift
Bundle.main.infoDictionary?["SomeKey"]
引用:
关于ios - 我可以在 info.plist 中定义用户定义的 key 吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48819534/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) | Powered by Discuz! X3.4 |