I'm trying to build an app that return the following information:
- IMEI
- ICCID
- IMSI
I saw that I could use CoreTelephony, but I came to doubt: To use these headers files (Import CoreTelephony.h from class-dump), the device must be jailbroken?
If not, the CoreTelephony its valid only for iOS6?
Thats how I do:
CTServerConnectionRef conn;
void ConnectionCallback(CTServerConnectionRef connection, CFStringRef string, CFDictionaryRef dictionary, void *data) {
NSLog(@"ConnectionCallback");
CFShow(dictionary);
}
- (NSString *)coreTelephonyInfoForKey:(const NSString *)key {
NSString *retVal = nil;
conn = _CTServerConnectionCreate(kCFAllocatorDefault, ConnectionCallback,NULL);
if (conn) {
struct CTResult result;
CFMutableDictionaryRef equipmentInfo = nil;
_CTServerConnectionCopyMobileEquipmentInfo(&result, conn, &equipmentInfo);
if (equipmentInfo) {
retVal = [NSString stringWithString:CFDictionaryGetValue(equipmentInfo, (__bridge const void *)(key))];
CFRelease(equipmentInfo);
}
CFRelease(conn);
}
return retVal;
}
- (NSString *)IMEI {
return [self coreTelephonyInfoForKey:@"kCTMobileEquipmentInfoIMEI"];
Here is my CoreTelephony.h