傳回來的json是text/html铝侵,是不可接受格式,那么就是說:
1触徐、讓AFNetworking接受傳回值是text/html格式咪鲜;
manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
2、把text/html這種json序列化(serializer)成二進(jìn)制格式(NSData)撞鹉,然后再解析出來疟丙,就是用NSData當(dāng)中間層。
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
拿到responseObject后鸟雏,如果外層是字典:
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];