美文网首页其他iOS开发攻城狮的集散地iOS Developer
iOS获取app应用版本信息&获取设备的基本信息

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

作者: huanghy | 来源:发表于2016-07-05 14:37 被阅读463次
    • 获取手机应用的版本信息
      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应用版本信息&获取设备的基本信息

        本文链接:https://www.haomeiwen.com/subject/mdgcjttx.html