1.我們將網(wǎng)址進(jìn)行轉(zhuǎn)碼
NSString *url = [strUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
2.更改請(qǐng)求的格式
AFHTTPRequestOperationManager *requestManager = [AFHTTPRequestOperationManager manager];
requestManager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
3.怎么判斷一個(gè)字典的返回值為空,如果返回的responseObject[@"addressInfo"]為空的話,就不執(zhí)行下面的代碼啄清。
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"];
}