iOS获取app应用版本信息&获取设备的基本信息

  • 获取手机应用的版本信息
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *name = [infoDictionary objectForKey:@"CFBundleName"];
    NSString *version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    NSString *build = [infoDictionary objectForKey:@"CFBundleVersion"];

    NSLog(@"%@,%@,%@,%@",infoDictionary,name,version,build);
    
  • 获取设备的基本信息
    通过UIDevice类的对象,可以获取iOS设备如下的信息
    UIDevice的属性:
    @property(nonatomic,readonly,strong) NSString *name; // 设备的名称,如xxx的iPhone6s
    @property(nonatomic,readonly,strong) NSString *model; // 设备的类型,例如.iPhone,iPod touch
    @property(nonatomic,readonly,strong) NSString *localizedModel; // localized version of model
    @property(nonatomic,readonly,strong) NSString *systemVersion; // 操作系统版本号. 如:8.3, 9.2等

    //获取当前设备对象                            
     UIDevice *device = [UIDevice currentDevice];
     NSLog(@"name: %@", device.name);
     NSLog(@"model:%@", device.model);                            
     NSLog(@"localizedModel: %@", device.localizedModel);
     NSLog(@"systemVersion: %@", device.systemVersion);
     //获取设备的UUID   
     NSLog(@"identifierForVendor: %@", device.identifierForVendor.UUIDString);    

你可能感兴趣的:(iOS获取app应用版本信息&获取设备的基本信息)