There is! It’s not documented at all, and I highly doubt this would work on a non-jailbroken phone (as it requires using files not in the sandbox). However, here is how it is done.
The iPhone file system keeps two softlinks:
static NSString *carrierPListSymLinkPath = @"/var/mobile/Library/Preferences/com.apple.carrier.plist";
static NSString *operatorPListSymLinkPath = @"/var/mobile/Library/Preferences/com.apple.operator.plist";
when these links are pointing at the same file, the telephone is not roaming. When pointing at different files, the telephone is romaing.
Simplified code (no error checking, etc):
- (BOOL)isRoaming
{
NSFileManager *fm = [NSFileManager defaultManager];
NSError *error;
NSString *carrierPListPath = [fm destinationOfSymbolicLinkAtPath:carrierPListSymLinkPath error:&error];
NSString *operatorPListPath = [fm destinationOfSymbolicLinkAtPath:operatorPListSymLinkPath error:&error];
return (![operatorPListPath isEqualToString:carrierPListPath]);
}