gpt4 book ai didi

ios - 我可以在 info.plist 中定义用户定义的键吗

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:36:19 24 4
gpt4 key购买 nike

我可以用给定名称“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"]

引用:

Info Plist Docs

Reserved Keys

关于ios - 我可以在 info.plist 中定义用户定义的键吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48819534/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com