在运行时检测我的 iPhone 应用程序是从哪个国家/地区的 App Store 下载的?
我的 iPhone 应用程序中有一个功能,出于商业原因,该功能只能向美国的客户显示/可用。 如果我想将此应用程序发布到美国以外的应用程序商店,那么在不依赖用户定义的设置(例如语言和区域设置)的情况下确定我所在国家/地区的最佳方法是什么?
在我看来,理想的解决方案是有一些运行时属性可以告诉我应用程序是从哪个 App Store 国家/地区下载的,我可以采取相应的操作。 浏览文档并搜索网络,我在这个部门没有想出任何东西。
我不认为该解决方案是 100% 万无一失的,只要用户不在他们所说的国家/地区,但尽可能接近就更好了。
我认为一种解决方案是在 App Store 上为新产品进行单独构建,并有两个版本,一个用于美国,一个用于其他国家,但这似乎并不理想。 我希望它可以是App Store上的同一个产品,以防止出现用户评论碎片化之类的情况。
提前致谢!
I have a feature in my iPhone application that, for business reasons, should only be shown/available to customers in the US. If I want to release this app to App Stores outside the US, what's the best way to figure out which country I'm in without relying on user-defined settings such as language and locale?
In my mind, the ideal solution is that there's some runtime property that can tell me which App Store country the app was downloaded from, and I can take action accordingly. Looking through the docs and searching the web, I'm not coming up with anything in this department.
I don't expect the solution to be 100% foolproof as far as users not being in the country they say they're from, but as close as possible would be nice.
I suppose one solution would be to make a separate build for a new product on the App Store and have two versions, one for the US and one for the others, but that doesn't seem ideal. I'm hoping it can be the same product on the App Store to prevent things like fragmentation of user reviews.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它要么是区域设置,要么是不同商店的不同版本。
对我来说,Locale 选项似乎是工作量最少的,并且可能 95% 的时间都是正确的......
It's either Locale, or different versions for different stores.
To me the Locale option seems like the least amount of work and will probably be correct 95% of the time...
我还认为使用 NSLocale 将是确定用户所在国家/地区的最佳解决方案。
这样做的方法如下:
但是,由于无法保证用户不会更改其国际设置,因此您可能别无选择,只能发布单独的应用程序,一个面向美国受众,另一个面向国际受众。
I also think using NSLocale would be the best possible solution for determining the user's country.
Here's how it would be done:
However, since there's no guarantee that the user won't change their international settings, you might have no choice but to release separate apps, one for a US audience and another for an international one.
这个问题很老了,但由于其他人可能有相同的查询,我正在插话:)鉴于除了通过本地检索之外它不可能“明智地”实现,一种机制是通过客户注册。 在注册表中,您可以询问他们注册的国家/地区并从那里获取......
The question is very old, but since others may have the same querying, i'm chipping in :) Given that it's not 'sensibly' possible other than through local retrieval, one mechanism would be through customer registration. In the registration form, you can then ask the country where they are registering from and take it from there...