标签:
1 //创建管理者 2 AFHTTPRequestOperationManager *manger=[AFHTTPRequestOperationManager manager]; 3 manger.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html",nil];
4 manger.requestSerializer = [AFHTTPRequestSerializer serializer]; 5 manger.responseSerializer = [AFHTTPResponseSerializer serializer]; 6 NSString *url=[NSString stringWithFormat:@"*********phoneNumber=%@&pwd=%@",self.phoneNumTF.text,self.secretTF.text]; 7 8 NSLog(@"%@",url); 9 10 [manger GET:url parameters:nil success:^(AFHTTPRequestOperation * _Nonnull operation, id _Nonnull responseObject) { 11 12 NSLog(@"responseObject###########%@",[responseObject class]); 13 NSLog(@"#######responseObject########"); 14 16 } failure:^(AFHTTPRequestOperation * _Nullable operation, NSError * _Nonnull error) { 17 18 NSLog(@"%@",error); 19 NSLog(@"######error######"); 20 21 }];
之前就是因为没写第3,4,5条,所以一直报错。
标签:
原文地址:http://www.cnblogs.com/zcl410/p/5012473.html