Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any ways to detect the roaming status on iOS 6?

My application using below methods to detect roamming in iOS 4 and 5.

NSString *carrierPListSymLinkPath = @"/var/mobile/Library/Preferences/com.apple.carrier.plist"; 
NSString *operatorPListSymLinkPath = @"/var/mobile/Library/Preferences/com.apple.operator.plist"; 

NSFileManager *fm = [NSFileManager defaultManager]; 
NSError *error = nil; 

NSString *carrierPListPath = [fm destinationOfSymbolicLinkAtPath:carrierPListSymLinkPath error:&error];     

NSString *operatorPListPath = [fm destinationOfSymbolicLinkAtPath:operatorPListSymLinkPath error:&error];

return (![operatorPListPath isEqualToString:carrierPListPath]); 

But this code always return false on iOS6 (even i am not roaming, it always return false), i think it maybe the plist file location changed by Apple, does any one face the same issue, can anyone help me on this?

Thanks.

like image 701
JoanneWong Avatar asked Sep 18 '12 08:09

JoanneWong


People also ask

How do I know if my iPhone has roaming?

If you see No Service in the status bar of your iPhone, open Settings and tap Cellular, or Cellular Data, or Mobile Data. Tap Cellular Data Options and make sure that Data Roaming is on.


2 Answers

This is an answer I got from apple :

"Indeed. Unfortunately these files were never documented as public API and, as such, were never intended to be used by third party apps. In a lot of cases such restrictions are enforced, either technically by the iOS sandbox or administratively by App Review. However, neither of these processes is perfect, and there are occasions where apps end up doing things they shouldn't be doing. Unfortunately this puts these apps in a difficult position when the enforcement improves, as has happened in this case.

As to direct workarounds there really isn't one. The only public telephony APIs on iOS are provided by the Core Telephony framework. Its CTTelephonyNetworkInfo class gives you information about the user's 'home' cellular server, not about the network that they are roaming on."

They suggest you use geo-ip check.

like image 57
Trausti Thor Avatar answered Sep 19 '22 15:09

Trausti Thor


Facing the same problem here since iOS6 beta 1, since that version /var/mobile/Library/Preferences/com.apple.operator.plist sym-link is no more reversable.

No other device-only way are public now, in the meanwhile the unique solution is to check for the ip via geo-ip, as Trausti Thor said, or checking for the ip class if you are developing an app for a single carrier.

like image 37
Matteo Crippa Avatar answered Sep 18 '22 15:09

Matteo Crippa