Open yiyie1 opened 8 years ago
2 Replace below code with ViewControllerUtil SetTitle;
UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
title.text = AppCoupon;
title.textAlignment = NSTextAlignmentCenter;
title.textColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0];
title.font = [UIFont fontWithName:kHelveticaRegular size:17.0];
self.navigationItem.titleView = title;
3 Code refactor: Move all of below AFNetwork code to ViewControllerUtil;
AFHTTPSessionManager session = [AFHTTPSessionManager manager]; session.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; NSMutableDictionary parme = [NSMutableDictionary dictionary]; parme[@"cmd"] = @"19"; parme[@"user_id"] = _uid; TalkLog(@"Me ID -- %@",_uid); [session POST:PATH_GET_LOGIN parameters:parme progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
TalkLog(@"Me result: %@",responseObject);
dic = [solveJsonData changeType:responseObject];
if (([(NSNumber *)[dic objectForKey:@"code"] intValue] == 2))
{
}
else if (([(NSNumber *)[dic objectForKey:@"code"] intValue] == 4))
{
[MBProgressHUD showError:kAlertIDwrong];
return;
}
else if (([(NSNumber *)[dic objectForKey:@"code"] intValue] == 3))
{
[MBProgressHUD showError:kAlertdataFailure];
return;
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[MBProgressHUD showError:kAlertNetworkError];
return;
}];
4 clean up self.var and _var in the code.
5 基于目前的数据表在增加新的数据字段后,再使用函数save存储该字段数据时会失败;WA是新建表
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { TalkLog(@"buttonIndex = [%ld]",(long)buttonIndex); switch (buttonIndex) { case 0://照相机