iOS 怎樣獲得設備及應用相關信息

  UIDevice *device = [[UIDevice alloc] init];
    NSLog(@"設備所有者名稱  %@  ",device.name);//設備所有者名稱
    NSLog(@"設備類別  %@",device.model);//設備類別
    NSLog(@"本地化版本  %@",device.localizedModel);//本地化版本
    NSLog(@"當前系統版本  %@",device.systemVersion);//當期版本
    NSLog(@"當前系統  %@",device.systemName);//當前系統
    NSLog(@"系統唯一標示符  %@",[[[UIDevice currentDevice ] identifierForVendor] UUIDString]);//唯一標示
    NSLog(@"電量   %f",[[UIDevice currentDevice] batteryLevel]);//輸出-1爲模擬器  輸出0-1爲真機
    

     NSArray *languageArray = [NSLocale preferredLanguages];
    for (NSString *language in languageArray) {
        NSLog(@"語言:%@", language);//語言

    }


    NSLocale *locale = [NSLocale currentLocale];
    NSString *country = [locale localeIdentifier];
    NSLog(@"國家:%@", country); //國別
    
  
    //分辨率
    CGFloat scale_screen = [UIScreen mainScreen].scale;
    NSLog(@"screen w:%f",width*scale_screen);
    NSLog(@"screen h:%f",height*scale_screen);
    
    //獲得運營商信息
    CTTelephonyNetworkInfo *info = [[CTTelephonyNetworkInfo alloc] init];
 
    NSLog(@"info  %@", info);

    //  獲取運行商的名稱
    CTCarrier *carrier = [info subscriberCellularProvider];
    NSString *mCarrier = [NSString stringWithFormat:@"%@",[carrier carrierName]];
    NSLog(@"%@", mCarrier);

    //app應用相關信息的獲取
    NSDictionary *dicInfo = [[NSBundle mainBundle] infoDictionary];
    NSLog(@"應用所有信息 %@",dicInfo);
    NSString *strAppName = [dicInfo objectForKey:@"CFBundleDisplayName"];
    NSLog(@"App應用名稱:%@", strAppName);
    NSString *strAppVersion = [dicInfo objectForKey:@"CFBundleShortVersionString"];
    NSLog(@"App應用版本:%@", strAppVersion);
    NSString *strAppBuild = [dicInfo objectForKey:@"CFBundleVersion"];
    NSLog(@"App應用Build版本:%@", strAppBuild);
    NSString *strAppBundleIdentifier = [dicInfo objectForKey:@"CFBundleIdentifier"];
    NSLog(@"App應用唯一標示符:%@", strAppBundleIdentifier);
    NSLog(@"wanluo:%@",info.currentRadioAccessTechnology);
   
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章