Get the iphone's IMSI serial number
#include <dlfcn.h>
#define PRIVATE_PATH "/system/library/privateframeworks/coretelephony.framework/ Coretelephony "
-void Getimsi () {
#if! Target_iphone_simulator
void *kit = Dlopen (private_path,rtld_lazy);
NSString *imsi = nil;
int (*ctsimsupportcopymobilesubscriberidentity) = Dlsym (Kit, "ctsimsupportcopymobilesubscriberidentity");
IMSI = (nsstring*) ctsimsupportcopymobilesubscriberidentity (nil);
Dlclose (kit);
Uialertview *alert = [[Uialertview alloc] initwithtitle:@ "IMSI"
message:imsi delegate:self
cancelbuttontitle:@ "OK"
Otherbuttontitles:nil];
[Alert show];
[Alert release];
#endif
}
Get operators through IMSI
NSString *imsi = ctsimsupportcopymobilesubscriberidentity ();
NSString *usermobiletype = [statisticsoperation getcarrier:imsi];
The Getcarrier method is as follows
+ (NSString *) Getcarrier: (NSString *) IMSI {
if (imsi = = Nil | | [Imsi isequaltostring:@ "SIM not Inserted"]) {return
@ "Unknown";
}
else {
if ([[Imsi substringwithrange:nsmakerange (0, 3)] isequaltostring:@ "460"]) {
Nsinteger MNC = [[IMSI Substringwithrange:nsmakerange (3, 2)] intvalue];
Switch (MNC) {case: case:
' return
@ ' Mobile ';
break;
Case:
"Unicom";
break;
Case:
"Telecom";
break;
Case: Return
@ "Tietong";
break;
Default: Break
;
}}} return @ "Unknown";
}
Get cell phone number
+ (nsstring*) getphonenumber
{
NSString *num = [[Nsuserdefaults standarduserdefaults] stringforkey:@ " Sbformattedphonenumber "];
NSLog (@ "Phone number:%@", num);
return num;
}
The above mentioned is the entire content of this article, I hope you can enjoy.