iOS 获取App、 手机信息

1: 获取App相关信息

//获取bundle Identifier信息
NSString *bundleIdentifier = NSBundle.mainBundle.bundleIdentifier;
    
//获取版本号
NSString *version = [NSBundle.mainBundle.infoDictionary objectForKey:@"CFBundleShortVersionString"];
    
//获取build号
NSString *build = [NSBundle.mainBundle.infoDictionary objectForKey:@"CFBundleVersion"];
    
//获取App显示名
NSString *appName = [NSBundle.mainBundle.infoDictionary objectForKey:@"CFBundleDisplayName"];


其实NSBundle.mainBundle.infoDictionary获得的是一个字典, 里面放着Info.plist文件中的各种信息, 根据不同的键即可获取, 如:
CFBundleDevelopmentRegion
CFBundleDisplayName
CFBundleExecutable
CFBundleExecutablePath
CFBundleIdentifier
CFBundleInfoDictionaryVersion
CFBundleInfoPlistURL
CFBundleName
CFBundlePackageType
CFBundleShortVersionString
CFBundleSignature
CFBundleSupportedPlatforms

2:获取设备信息

//获取设备名称, 如:xxx的手机
NSString *deviceName = UIDevice.currentDevice.name;
    
//获取系统名称, 如:iOS
NSString *systemName = UIDevice.currentDevice.systemName;
    
//获取系统版本
NSString *systemVersion = UIDevice.currentDevice.systemVersion;
    
//获取设备的UUID
NSString *deviceUUID = UIDevice.currentDevice.identifierForVendor.UUIDString;
    
//获取设备的型号, 如:iPhone
NSString *deviceModel = UIDevice.currentDevice.model;

参考:
https://blog.csdn.net/youshaoduo/article/details/52289820
https://www.jianshu.com/p/5f8cdec48085

你可能感兴趣的:(iOS 获取App、 手机信息)