iOS gets the device name and version number of the current app
- 2021-12-13 09:50:31
- OfStack
Without saying much, please look at the code:
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
CFShow(infoDictionary);
// app Name
NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
// app Version
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
// app build Version
NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
// Mobile phone serial number
NSString* identifierNumber = [[UIDevice currentDevice] uniqueIdentifier];
NSLog(@" Mobile phone serial number : %@",identifierNumber);
// Mobile Alias: User-defined name
NSString* userPhoneName = [[UIDevice currentDevice] name];
NSLog(@" Cell phone alias : %@", userPhoneName);
// Device name
NSString* deviceName = [[UIDevice currentDevice] systemName];
NSLog(@" Device name : %@",deviceName );
// Mobile phone system version
NSString* phoneVersion = [[UIDevice currentDevice] systemVersion];
NSLog(@" Mobile phone system version : %@", phoneVersion);
// Mobile phone model
NSString* phoneModel = [[UIDevice currentDevice] model];
NSLog(@" Mobile phone model : %@",phoneModel );
// Local model (Name of Internationalized Region)
NSString* localPhoneModel = [[UIDevice currentDevice] localizedModel];
NSLog(@" Internationalized zone name : %@",localPhoneModel );
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
// Current application name
NSString *appCurName = [infoDictionary objectForKey:@"CFBundleDisplayName"];
NSLog(@" Current application name: %@",appCurName);
// Current application software version For example: 1.0.1
NSString *appCurVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
NSLog(@" Current application software version :%@",appCurVersion);
// Current application version number int Type
NSString *appCurVersionNum = [infoDictionary objectForKey:@"CFBundleVersion"];
NSLog(@" Current application version number: %@",appCurVersionNum);