What API to use to check if user is about to use roaming call?

I'm developing an app that handles phone numbers and bumped into a problem that I have to pop up a warning message if a user is trying to make a roaming call (to make it clearer, I'm implying the user is in another province/state). I found this article(Is there any way to determine if the iphone is roaming?) from stackoverflow but it's quite old.

Has Apple provided any api for this? If Apple has, what's the name of the api/class to use? If hasn't, is that article still the only solution for this problem?

Thank you!


No there is no API that will allow you to detect if the user is roaming. Also the tutorial you point to is for jailbroken devices. It will not work on an Appstore app.

You can read out the users carrier with the CTCarrier class. But it clearly states that you will not be able to detect roaming:

Discussion

This string is provided by the carrier and formatted for presentation to the user. The value does not change if the user is roaming; it always represents the provider with whom the user has an account.

链接地址: http://www.djcxy.com/p/58400.html

上一篇: 如何在iOS7中切换网络(2G / 3G / 4G)而不越狱?

下一篇: 用什么API来检查用户是否要使用漫游呼叫?