我们可以从 iPhone 的 App Store 获取应用程序的版本号吗?

发布于 2024-12-06 20:00:58 字数 223 浏览 1 评论 0原文

有没有办法直接从 App-Store / i-Tunes 获取应用程序版本号?

在浏览完所有评论后,如果我错了,请纠正我。

  1. 我们不应该以编程方式向用户显示有关新更新可用性的本地通知(作为警报)?

我浏览了 HIG 指南,但无法找到这样的具体内容。所以在决定时很少感到困惑。

Instead of using a web-service to get current application version number and comparing it in my code for popping up update alert, Is there any way to obtain the application version number from App-Store / i-Tunes directly?

After going through all the comments correct me if i am wrong.

  1. We should not show a Local Notification(as alert) to User regarding availability of new update programatically?

I went though HIG Guidelines, but could not fing such creteria. So little confused in deciding.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半边脸i 2024-12-13 20:00:58

像这样的警报更新肯定会违反苹果的指导方针。对于 iOS 设备,应用程序警报由 App Store 应用程序显示,并带有显示可用更新数量的徽章。开发人员无需执行任何操作。

如果您担心用户错过您的应用程序更新,请放心,iOS 用户会密切关注应用程序商店应用程序和应用程序。知道所有更新都通过它进行。

但是,您可以通过一些巧妙的方法来确定这是更新后的第一次运行,而无需联系任何网络服务或 iTunes/App 商店。

我知道的黑客之一:

获取库目录路径 -

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *libPath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;

libPath 类似于 - /var/mobile/Applications/8CFB747F-9446-44CB-98B9-C6FF1CF7BF93/Library /Library

之前的这个随机字符串随着每次更新而变化。您可以将此字符串保存在 NSUserDefaults 中,并在每次启动时将该路径与保存的字符串进行比较。如果发现字符串不同,则意味着这是您更新后的第一次运行。显示更新提醒!然后用新的字符串更新保存的字符串。

Alert updates like this will certainly be against Apple guidelines. For iOS devices, application alerts are displayed by the App store app with a badge displaying the number of updates available. There is nothing a developer needs to do.

If you are worried about the user missing your app update, rest assured that iOS users keep an eye on the app-store app & know that all updates come through it.

However, there are hacky ways by which you can figure out that this is your first run after an update without contacting any web service or iTunes/App store.

One of the hacks known to me:

Fetch the library directory path-

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *libPath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;

libPath would be something like - /var/mobile/Applications/8CFB747F-9446-44CB-98B9-C6FF1CF7BF93/Library

This random string before /Library changes with every update. You can save this string in NSUserDefaults, and compare the path with the saved string on every launch. If the strings are found to be different, it implies that this is your first run after the update. Display the update alert! Then update the saved string with the new one.

流年已逝 2024-12-13 20:00:58

是的。您可以向 itunes.apple.com 服务器发出 HTTP 请求,同时模仿 iTunes 的用户代理字符串,获取应用程序在 App Store 中的 URL,并解析返回的 HTML 或 XML 以查找版本字符串, Apple 审批团队可能会也可能不会接受。但这不太值得,而且它还提供了不常见且意想不到的用户体验。

Yes. You could do an HTTP request to the itunes.apple.com server, while mimicking the User Agent string of iTunes, for your app's URL in the App store, and parse the returned HTML or XML you get back to find the version string, which may or may not be acceptable to Apple's approval team. But that's unlikely to be worth it, and it also presents an uncommon and unexpected user experience.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文