gpt4 book ai didi

xcode - 使用 CFBundleGetVersionNumber

转载 作者:行者123 更新时间:2023-12-05 01:13:11 25 4
gpt4 key购买 nike

我想使用以下方法从 info.plist 获取版本号:

NSString *version = (NSString *)CFBundleGetVersionNumber(CFBundleGetMainBundle());

这并没有给我预期的 Bundle Version 字符串值。

这确实给了我期望的字符串:

NSString *version = (NSString *)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey);

我想知道如何让第一个表单工作,因为它看起来是从 info.plist 获取版本的首选方式。

这是我使用结果的方式:

htmlAbout = [htmlAbout stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"[version]"] withString:version];

我在 Xcode 4.1 中工作

谢谢

最佳答案

您的程序中存在严重的转换错误:CFBundleGetVersionNumber 返回 UInt32,它不能通过类型转换转换为 NSString(或任何 objc类型)。

关于xcode - 使用 CFBundleGetVersionNumber,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7564394/

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