gpt4 book ai didi

ios - 来自 iTunes 的版本信息不正确(以编程方式 Objective-c)

转载 作者:行者123 更新时间:2023-12-01 19:53:19 26 4
gpt4 key购买 nike

我已经实现了一些代码来检查 appStore 版本是否高于当前应用程序版本,并在这种情况下向用户显示弹出窗口以进行更新。

我正在使用以下代码:-

NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
NSString *appStoreURL = [@"http://itunes.apple.com/lookup?bundleId="stringByAppendingString:bundleIdentifier];

// Get the main bundle of the app so that we can determine the app's version number
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
NSString *appVersion = [infoDict objectForKey:@"CFBundleShortVersionString"]; // example: 1.0.0

NSData *dict = [NSData dataWithContentsOfURL:[NSURL
URLWithString:appStoreURL]];
NSError* error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:dictoptions:kNilOptions error:&error];
NSLog(@"%@", json);

当我以编程方式从 URL 获取内容时,它会给出版本“2.5”。请引用以下:-

enter image description here

但是当我从浏览器下载文本文件时,它会显示版本“2.6”请参阅下面来自 Textedit 的屏幕截图。

enter image description here

有人遇到同样的问题吗?

最佳答案

以编程方式获取新版本的应用程序通常需要 6-8 小时。目前,我在我的应用程序中使用相同的代码并且工作正常。您的代码很好,只需等待从 Apple 查找 URL 中获取正确的字典即可。

关于ios - 来自 iTunes 的版本信息不正确(以编程方式 Objective-c),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44300904/

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