iOS获取设备型号和App版本号等信息
2016-12-20 00:00
489 查看
摘要: 222
// 获取当前App的基本信息字典
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
//app名称
NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
// app版本
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
// app build版本
NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
//手机序列号
NSString* identifierNumber = [[UIDevice currentDevice] uniqueIdentifier];
//手机别名: 用户定义的名称
NSString* userPhoneName = [[UIDevice currentDevice] name];
//设备名称
NSString* deviceName = [[UIDevice currentDevice] systemName];
//手机系统版本
NSString* phoneVersion = [[UIDevice currentDevice] systemVersion];
//手机型号
NSString* phoneModel = [[UIDevice currentDevice] model];
//地方型号 (国际化区域名称)
NSString* localPhoneModel = [[UIDevice currentDevice] localizedModel];
最新消息-http://www.jianshu.com/p/0d84e6852c5a#
∞∞∞∞∞∞∞如何获取内网 IP?¢¢¢¢¢¢¢¢¢¢¢¢¢
+ (NSString *)deviceIPAdress
{
NSString *address = @"an error occurred when obtaining ip address";
struct ifaddrs *interfaces = NULL;
struct ifaddrs *temp_addr = NULL;
int success = 0;
success = getifaddrs(&interfaces);
if (success == 0)
{ // 0 表示获取成功
temp_addr = interfaces;
while (temp_addr != NULL)
{
if (temp_addr->ifa_addr->sa_family == AF_INET)
{
// Check if interface is en0 which is the wifi connection on the iPhone
if ([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"])
{
// Get NSString from C String
address = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)];
}
}
temp_addr = temp_addr->ifa_next;
}
}
freeifaddrs(interfaces);
NSLog(@"手机的IP是:%@", address);
return address;
}
记得导入:
#import <arpa/inet.h>
#import <ifaddrs.h>
原文1:http://blog.csdn.net/u013935547/article/details/51782810
原文2链接:http://www.jianshu.com/p/0d84e6852c5a
// 获取当前App的基本信息字典
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
//app名称
NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
// app版本
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
// app build版本
NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
//手机序列号
NSString* identifierNumber = [[UIDevice currentDevice] uniqueIdentifier];
//手机别名: 用户定义的名称
NSString* userPhoneName = [[UIDevice currentDevice] name];
//设备名称
NSString* deviceName = [[UIDevice currentDevice] systemName];
//手机系统版本
NSString* phoneVersion = [[UIDevice currentDevice] systemVersion];
//手机型号
NSString* phoneModel = [[UIDevice currentDevice] model];
//地方型号 (国际化区域名称)
NSString* localPhoneModel = [[UIDevice currentDevice] localizedModel];
最新消息-http://www.jianshu.com/p/0d84e6852c5a#
∞∞∞∞∞∞∞如何获取内网 IP?¢¢¢¢¢¢¢¢¢¢¢¢¢
+ (NSString *)deviceIPAdress
{
NSString *address = @"an error occurred when obtaining ip address";
struct ifaddrs *interfaces = NULL;
struct ifaddrs *temp_addr = NULL;
int success = 0;
success = getifaddrs(&interfaces);
if (success == 0)
{ // 0 表示获取成功
temp_addr = interfaces;
while (temp_addr != NULL)
{
if (temp_addr->ifa_addr->sa_family == AF_INET)
{
// Check if interface is en0 which is the wifi connection on the iPhone
if ([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en0"])
{
// Get NSString from C String
address = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)];
}
}
temp_addr = temp_addr->ifa_next;
}
}
freeifaddrs(interfaces);
NSLog(@"手机的IP是:%@", address);
return address;
}
记得导入:
#import <arpa/inet.h>
#import <ifaddrs.h>
原文1:http://blog.csdn.net/u013935547/article/details/51782810
原文2链接:http://www.jianshu.com/p/0d84e6852c5a
相关文章推荐
- iOS获取设备型号和App版本号等信息
- iOS获取设备型号和App版本号等信息
- 获取iOS App 包名、版本号、设备信息、签名
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- iOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- iOS获取设备的序列号,自定义名,设备名,手机版本号,手机序列号,,手机型号,地方型号,当前App名称,App版本号...
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- 获取iOS App 包名、版本号、设备信息、签名
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- IOS 获取Model(设备型号)Version(设备版本号)app(程序版本号)等
- swift 获取app、ios 版本号及设备信息
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等