检测应用程序是否在 iOS beta 上运行?
我在 iOS 应用商店中有一些支持 iAd/AdMob 的应用。我注意到每次 iOS 测试版发布时,广告请求都会直线下降。我假设这是由于许多人运行测试版操作系统,因此几乎总是会收到 iAd 测试广告。有什么方法可以让我的代码检测应用程序是否处于测试版操作系统版本上?这样我就可以默认使用 AdMob,从而获得一些收入。
I have some iAd/AdMob supported apps on the iOS app store. I notice every time a iOS beta comes out, ad requests plummet. I'm assuming this is due to many people running the beta OS, and therefor almost always get a iAd test ad. Is there some way my code can detect if an app is on a beta OS version? This way I could default to AdMob so I get some revenue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这不是一个特别漂亮的方法,但您可以读取设备版本并将其与当前已知的最高版本进行比较,如果设备版本更高,则恢复为 AdMob。
这将以字符串形式获取设备版本:
您可以将其转换为浮点值并将其与硬编码版本进行比较,但这意味着在新 iOS 发布后部署新版本:
作为一个稍微更好的解决方案,您可以从网站请求当前最高 iOS 发行版本...只需在您的网站上放置一个内容为“4.3”的 iosversion.txt 文件,然后使用它来控制开关。
不幸的是,似乎没有
[[UIDevice currentDevice] isBeta]
类型的方法。It's not a particularly pretty way to do it, but you could read the device version and compare it to the highest current known release version, and revert to AdMob if the device version is higher.
This will get the device version as a string:
You can convert this to a float value and compare it to a hard-coded version, but this would mean deploying a new version once the new iOS is released:
As a slightly better solution you could request the current maximum iOS release version from a website... just drop a iosversion.txt file on your site with the contents "4.3" and use that to control the switch.
Unfortunately there doesn't seem to be a
[[UIDevice currentDevice] isBeta]
type method.据传言,iOS 8 版本将于 9 月发布。
因此,您可以使用:
或获取网址的标题: https://www.apple.com/ios/< /a> 并检查 iOS ?
According to rumors, the iOS version 8 will come in September.
So, you can use:
or get the title of url: https://www.apple.com/ios/ and check iOS ?