首先注明:需要在越獄狀態(tài)下
首先使用MonkeyDev建立一個(gè)Command-Line
的程序
然后添加libMobileGestalt.dylib
-w1135
然后在monkeydev.entitlements
中添加權(quán)限com.apple.coretelephony.Identity.get
-w1141
main.c
如圖-w695
#include <stdio.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
OBJC_EXTERN CFStringRef MGCopyAnswer(CFStringRef key) WEAK_IMPORT_ATTRIBUTE;
int main (int argc, const char * argv[])
{
CFStringRef result = MGCopyAnswer(CFSTR("InternationalMobileEquipmentIdentity"));
NSString *IMEI = (__bridge NSString *)result;
NSLog(@"%@",IMEI);
// insert code here...
printf("Hello, World!\n");
return 0;
}
Build
到手機(jī)上進(jìn)行測(cè)試,成功獲取到
-w476
打開手機(jī)查看是否和本機(jī)一致
-w255
完成!
Demo