-(void)getAppInfo
{
content = _opinionTV.text;
infoSource = InfoSource;//信息来源
tel = _phoneTV.text;
qq = _qqTV.text;
mail = _mailTV.text;
//提交时间
NSDate *now = [NSDate date];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit;
NSDateComponents *dateComponents = [calendar components:unitFlags fromDate:now];
int year = [dateComponents year];
int month = [dateComponents month];
int day = [dateComponents day];
int hour = [dateComponents hour];
int minute = [dateComponents minute];
NSLog(@"year is: %d", year);
NSLog(@"month is: %d", month);
NSLog(@"day is: %d", day);
NSLog(@"hour is: %d", hour);
NSLog(@"minute is: %d", minute);
//用户IMEI号(null)
sc = _CTServerConnectionCreate(kCFAllocatorDefault, callback, NULL);
_CTServerConnectionCopyMobileIdentity(&result, sc, &imei);
NSLog (@"IMEI is %@", imei);
//用OpenUDID替代IMEI
openUDID = [HXY_OpenUDID value];//导入HXY_OpenUDID文件
//连接网络类型
netKind = [self currentNetType];
// //属于哪个运营商
// NSString *carrierName = [UIDevice currentCarrierName];
//手机型号
phoneModel = [[UIDevice currentDevice] model];
NSLog(@"手机型号: %@",phoneModel );
//手机系统 + 系统版本号+app版本号
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
appVersion = [NSString stringWithFormat:@"%@%@ %@",[[UIDevice currentDevice] systemName],[[UIDevice currentDevice] systemVersion],[infoDictionary objectForKey:@"CFBundleShortVersionString"]];
NSLog(@"当前App版本:%@",appVersion);
dispatch_async(dispatch_get_main_queue(), ^{
[activityView startAnimating];
});
[[NSNotificationCenter defaultCenter] postNotificationName:@"SubmitToTheServer" object:nil];}
//获取当前网络类型
-(NSString *)currentNetType
{
UIApplication *application = [UIApplication sharedApplication];
NSArray *subviews = [[[application valueForKey:@"statusBar"] valueForKey:@"foregroundView"]subviews];
NSNumber *dataNetWorkItemView = nil;
for (id subView in subviews) {
if ([subView isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) {
dataNetWorkItemView = subView;
break;
}
}
NSString *networkType = NetworkType_None;
switch ([[dataNetWorkItemView valueForKey:@"dataNetworkType"] integerValue]) {
case 0:
NSLog(@"No wifi or cellular");
networkType = NetworkType_None;
break;
case 1:
NSLog(@"2G");
networkType = NetworkType_2G;
break;
case 2:
NSLog(@"3G");
networkType = NetworkType_3G;
break;
case 3:
NSLog(@"4G");
networkType = NetworkType_4G;
default://5
NSLog(@"Wifi");
networkType = NetworkType_wifi;
break;
}
return networkType;
}