- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我们通过 CFBundleShortVersionString
将应用程序的当前版本与我们后端的版本进行比较,以确定我们是否要强制用户更新。出于某种原因,在发布新版本的前 24 小时内,CFBundleShortVersionString 返回错误的版本。到目前为止,我们已经尝试了多种解决方案,但似乎都没有奏效。这是我们用来比较的简化版本:
func needToUpdate(completion: @escaping (Bool) -> Void) {
guard let currentVersion = Foundation.Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String,
let currentVersionInt = Int(currentVersion.replacingOccurrences(of: ".", with: ""))
else { completion(false); return }
let versionInt = Int((versionObject.version ?? "0").replacingOccurrences(of: ".", with: "")) ?? 0
completion(currentVersionInt < versionInt)
}
此外,此问题仅在应用程序发布到应用程序商店后才会发生,因此我们无法在 xcode 中对其进行调试。我们曾尝试在午夜发布更新,但用户在早上仍然打电话说他们已更新应用程序,但弹出窗口仍然出现。知道是什么原因造成的吗?
最佳答案
不要将版本转换为 int,因为它可能会在版本号大于 9 时失败,例如1.10.0变成1100,大于2.1.0,变成210
您可以将结果字符串直接与 .compare() 进行比较,例如 "1.10.0".compare("2.1.0") ,它返回一个 ComparisonResult
关于ios - CFBundleShortVersionString 返回错误的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49012566/
我应该在这里做什么?我正在尝试提交新版本的应用程序,但是当我尝试在 Xcode 中将版本号从 1.0 更改为 1.1 时出现此错误。 最佳答案 您还应该更改您的 StickerPackExtensio
我开始为每个新构建的 CFBundleShortVersionString 使用增量编号(例如 1->2->3->4),现在我的版本为 24.0。我可以将其重置回使用不同的版本控制系统(例如 1.0.
将我的应用程序提交到应用程序商店时出现此错误: 这是我的 info.plist 文件中的相关部分: CFBundleInfoDictionaryVersion 6.0 CFBu
我们通过 CFBundleShortVersionString 将应用程序的当前版本与我们后端的版本进行比较,以确定我们是否要强制用户更新。出于某种原因,在发布新版本的前 24 小时内,CFBundl
我在我的代码中将部分附加到常量基本 URL 字符串: #define BASE_URL @"https://example.com/developer/" #define PHP_SCRIPT BAS
我在我的项目中使用它作为构建阶段: export PLISTBUDDY="/usr/libexec/PlistBuddy" export INFO="${CODESIGNING_FOLDER_PATH
我正在尝试使用 iOS7 上新提供的收据将我的付费应用程序转换为免费增值应用程序,同时我也在进行收据验证。 我有点困惑,因为收据返回的是当前版本和原始版本的 CFBundleVersion,而不是我们
我正在尝试使用以下方法获取应用程序的版本号: NSString * version = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFB
我正在尝试将应用程序的 1.0.0 版上传到 iTunes Connect。 CFBundleShortVersionString 设置为 1.0.0。 在存档、验证并尝试上传到 iTunes Con
有什么方法可以在我的 LaunchStoryboard 中将 CFBundleShortVersionString 显示为 UILabel 文本,而无需在每次递增时手动输入它?我知道如何在代码中执行此
我在提交应用程序更新时收到了来自 Apple 的以下电子邮件: We have discovered one or more issues with your recent delivery for
我有一个项目,它根据开发阶段(暂存、生产、开发)具有不同的目标。对于每个目标,我都有一个与之配套的 plist 文件。 我的问题是如何自动更新每个 plist 的 CFBundleShortVersi
我知道这是一个简单而愚蠢的问题,但我找不到为什么会出错。我想在获取 xcarchive 文件后打印项目的应用程序版本。为此,我正在使用 PlistBuddy。 /usr/libexec/PlistBu
所以我正在尝试将我的应用程序上传到应用程序商店,但我收到了这条错误消息。 错误 ITMS-90060:“此包无效。Info.plist 文件中键 CFBundleShortVersionString
对于我们的 iOS 应用程序,我们误用了 CFBundleShortVersionString 和 CFBundleVersion(我们交换了它们,不要问为什么......)但是现在我们想改变它们并以
我正在构建一个与 cocoapods 一起使用的框架,并且我想将 pod 版本(在 .podspec 中相同)反射(reflect)到框架 CFBundleVersion(和/或)CFBundleSh
我在 Appstore 市场上当前的 iOS 应用有以下 bundle 版本。 CFBundle 版本 10301CFBundleShortVersionString 1.3.0 我这周要更新我的应用
这是我第一次提交 iOS 应用程序,我不希望我的应用程序被拒绝。 这是来自 Apple 文档: CFBundleVersion(字符串 - iOS、OS X)指定 bundle 的构建版本号,它标识
我有一个使用 receive_sharing_intent 的 Flutter 应用程序包,根据插件的要求,我创建了一个共享扩展。 我的应用程序和扩展可以正常构建和运行,但是当我存档和分发我的应用程序
我知道“CFBundleVersion”plist 键有一个常量 - 定义为 kCFBundleVersionKey在 CoreFoundation 的 CFBundle.h 头文件中。 但是“CFB
我是一名优秀的程序员,十分优秀!