gpt4 book ai didi

iphone - 如何向用户显示我的App当前的项目版本?

转载 作者:行者123 更新时间:2023-12-03 16:02:05 25 4
gpt4 key购买 nike

我想将当前版本添加到我的应用程序的“关于”部分。如所附屏幕截图所示,Apple 提供版本控制。

如何在您的应用中显示这些设置?

Screenshot of Target 'myApp' Info

最佳答案

经过进一步的搜索和测试,我自己找到了解决方案。

NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSLog(@"%i Keys: %@", [infoDictionary count],
[[infoDictionary allKeys] componentsJoinedByString: @" ,"]);

这个片段给了我以下输出:

20 Keys : NSBundleResolvedPath ,CFBundleVersion ,NSBundleInitialPath ,CFBundleIdentifier ,NSMainNibFile ,CFBundleIconFile ,CFBundleInfoPlistURL ,CFBundleExecutable ,DTSDKName ,UIStatusBarStyle ,CFBundleDevelopmentRegion ,DTPlatformName ,CFBundleInfoDictionaryVersion ,CFBundleSupportedPlatforms ,CFBundleExecutablePath ,CFBundleDisplayName ,LSRequiresIPhoneOS ,CFBundlePackageType ,CFBundleSignature ,CFBundleName

所以解决方案很简单:

NSString *version =[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleVersion"];

但是,这不是屏幕截图中所示的当前项目版本,而是 plist 文件的捆绑版本。

关于iphone - 如何向用户显示我的App当前的项目版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1492351/

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