步骤如下:
1)导入CoreTelephony这个private framework
2)在xxx.m中加入红字部分:
#import "xxx.h"
extern NSString *CTSettingCopyMyPhoneNumber();
@implementation
+(NSString *)myNumber{
return CTSettingCopyMyPhoneNumber();
}
@end
3)在其它地方调用NSLog(@"myNumber=%@",[xxx myNumber]);即是本机号码
转载于:https://www.cnblogs.com/larryblog/archive/2012/09/11/2679882.html