1.我们将网址进行转码
NSString *url = [strUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
2.更改请求的格式
AFHTTPRequestOperationManager *requestManager = [AFHTTPRequestOperationManager manager];
requestManager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
3.怎么判断一个字典的返回值为空,如果返回的responseObject[@"addressInfo"]为空的话,就不执行下面的代码。
NSDictionary*dic=responseObject[@"addressInfo"];
if (!([dic count]==0))
{
[[NSUserDefaults standardUserDefaults] setObject:responseObject[@"addressInfo"][@"address"] forKey:@"userInfo"];
[[NSUserDefaults standardUserDefaults] setObject:responseObject[@"addressInfo"][@"areaId1"] forKey:@"areaId1"];
[[NSUserDefaults standardUserDefaults] setObject:responseObject[@"addressInfo"][@"areaId2"] forKey:@"areaId2"];
[[NSUserDefaults standardUserDefaults] setObject:responseObject[@"addressInfo"][@"areaId3"] forKey:@"areaId3"];
}