We have a product where the user registers by providing their phone number.
However after they register they could potentially change their sim.
Is it possib
Yes, of course it is possible. Link CoreTelephony.framework to make following code compile:
CTTelephonyNetworkInfo* info = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier* carrier = info.subscriberCellularProvider;
NSString *mobileCountryCode = carrier.mobileCountryCode;
NSString *carrierName = carrier.carrierName;
NSString *isoCountryCode = carrier.isoCountryCode;
NSString *mobileNetworkCode = carrier.mobileNetworkCode;
// Try this to track CTCarrier changes
info.subscriberCellularProviderDidUpdateNotifier = ^(CTCarrier* inCTCarrier) {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"User did change SIM");
});
};
By values of mobileCountryCode, mobileNetworkCode, carrierName, isoCountryCode you can judge about presence of SIM. (Without SIM they become incorrect).
There is also some undocumented functions/notifications in CoreTelephony, but your app may be banned by Apple if you'll use them. Anyway:
// Evaluates to @"kCTSIMSupportSIMStatusReady" when SIM is present amd ready;
// there are some other values like @"kCTSIMSupportSIMStatusNotInserted"
NSString* CTSIMSupportGetSIMStatus();
// Use @"kCTSIMSupportSIMStatusChangeNotification" to track changes of SIM status:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(SIMNotification:)
name:@"kCTSIMSupportSIMStatusChangeNotification"
object:nil
];
// This one copies current phone number
NSString* CTSettingCopyMyPhoneNumber()
Addendum Another possible (and legal) solution: if your company has a database of phone numbers, you can send an sms or call(and cut) any specific number to verify that user still uses the same phone number.
UPDATE Function NSString* CTSettingCopyMyPhoneNumber()
doesn't work anymore (returns empty string).