Hi I am Working on SMSComposer and want to send SMS to Contacts from Address Book.I want to detect whether my iPhone has SIM Card in it or not
Is there any way i can reach this.?
I tried REachability Classes but it gives you information about WWAN and internet Connectivity.Does Core Telephony Framework has such Facility.? Something Like Carrier NAme etc for iPhone.??
Any help would be appreciated. Thanks Vikas
try to link the CoreTelephony.framework
then:
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>
NSString *_code = [[[[CTTelephonyNetworkInfo alloc] init] subscriberCellularProvider] mobileCountryCode];
you can find more information in the official documentation about that but briefly:
The value for this property is
nil
if any of the following applies:
There is no SIM card in the device.
The device is outside of cellular service range.
The value may be
nil
on hardware prior to iPhone 4S when in Airplane mode.
For this purpose you need to add MessageUI.framework framework...
Try this code...It may help you
Class messageClass = (NSClassFromString(@"MFMessageComposeViewController"));
if([messageClass canSendText]){
// Sim available
}
else{
//Sim not available
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.