您好,登錄后才能下訂單哦!
//idfa
[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
//idfv
[[[UIDevice currentDevice] identifierForVendor] UUIDString];
//網絡類型
- (NSString *) getNet
{
UIApplication *application = [UIApplication sharedApplication];
NSArray *subviews = [[[application valueForKey:@"statusBar"] valueForKey:@"foregroundView"]subviews];
NSNumber *dataNetWorkItemView = nil;
for (id subView in subviews) {
if ([subView isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) {
dataNetWorkItemView = subView;
break;
}
}
switch ([[dataNetWorkItemView valueForKey:@"dataNetworkType"] integerValue]) {
case 0:
NSLog(@"No wifi or cellular");
return @"null";
break;
case 1:
NSLog(@"2G");
return @"2G";
break;
case 2:
NSLog(@"3G");
return @"3G";
break;
default:
NSLog(@"Wifi");
return @"Wifi";
break;
}
return @"null";
}
//分辨率
- (NSString *) getFbl
{
//屏幕尺寸
CGRect rect = [[UIScreen mainScreen] bounds];
CGSize size = rect.size;
CGFloat width = size.width;
CGFloat height = size.height;
NSLog(@"print %f,%f", width, height);
//分辨率
CGFloat scale_screen = [UIScreen mainScreen].scale;
return [NSString stringWithFormat:@"%d*%d", (int)(width * scale_screen), (int)(height * scale_screen)];
}
//獲取運營商
- (NSString *)getOp
{
NSString * ret = @"";
CTTelephonyNetworkInfo *info = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [info subscriberCellularProvider];
if (carrier == nil)
{
[info release];
return @"null1";
}
NSString *code = [carrier mobileNetworkCode];
if (code == nil)
{
[info release];
return @"null2";
}
if ([code isEqualToString:@"00"] || [code isEqualToString:@"02"] || [code isEqualToString:@"07"])
{
ret = @"China Mobile";
}
if ([code isEqualToString:@"01"] || [code isEqualToString:@"06"])
{
ret = @"China Unicom";
}
if ([code isEqualToString:@"03"] || [code isEqualToString:@"05"])
{
ret = @"China Telecom";
}
if ([code isEqualToString:@"20"])
{
ret = @"China Tietong";
}
[info release];
return ret;
}
//獲取ip
- (NSString *)getIp
{
//獲取ip -(NSDictionary *)deviceWANIPAdress{
NSError *error;
NSURL *ipURL = [NSURL URLWithString:@"http://pv.sohu.com/cityjson?ie=utf-8
"];
NSMutableString *ip = [NSMutableString stringWithContentsOfURL:ipURL encoding:NSUTF8StringEncoding error:&error];
//判斷返回字符串是否為所需數據
if ([ip hasPrefix:@"var returnCitySN = "]) {
//對字符串進行處理,然后進行json解析
//刪除字符串多余字符串
NSRange range = NSMakeRange(0, 19);
[ip deleteCharactersInRange:range];
NSString * nowIp =[ip substringToIndex:ip.length-1];
//將字符串轉換成二進制進行Json解析
NSData * data = [nowIp dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary * dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
return [dict valueForKey:(@"cip")];
}else{
return @"ip";
}
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。