gpt4 book ai didi

ios - -[_NSInlineData objectForKey :]: unrecognized selector sent to instance 0x7e351cc0'

转载 作者:行者123 更新时间:2023-11-28 18:57:53 26 4
gpt4 key购买 nike

我正在尝试从我成功登录的详细信息中提取用户 ID。下面是我的代码`

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer=[AFHTTPResponseSerializer serializer];

[manager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];

manager.responseSerializer.acceptableContentTypes=[NSSet setWithObject:@"text/html"];


NSString *str=[NSString stringWithFormat:@"{\"username\":\"%@\",\"password\":\"%@\"}",self.usernameTextField.text,self.PswdTextField.text];
NSDictionary *param=@{@"params":str};


[manager POST:@"URL" parameters:param

success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"responseobject=%@ success=%@",responseObject,operation.responseString);

NSLog(@"success=%@",[responseObject objectForKey:@"userinfo"]);

我的订单:

responseobject=<7b22636f 6465223a 302c2275 73657269 6e666f22 3a7b2269 64223a22 31373222 2c226669 7273746e 616d6522 3a224179 75736822 2c226c61 73746e61 6d65223a 22477570 7461222c 22757365 726e616d 65223a22 67757074 61222c22 75736572 656d6169 6c223a22 66686a6a 6473227d 2c226d65 73736167 65223a22 4c6f6769 6e205375 63636573 7366756c 6c79227d> success={"code":0,"userinfo":{"id":"172","firstname":"Ay","lastname":"ta","username":"ss","useremail":"email"},"message":"Login Successfully"}

但无法从响应对象中提取数据。发生以下崩溃

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSInlineData objectForKey:]: unrecognized selector sent to instance 0x7e351cc0'

最佳答案

删除说

的行
manager.responseSerializer=[AFHTTPResponseSerializer serializer];

默认情况下,AFNetworking 将为您解析 JSON。 AFHTTPResponseSerializer 只会给你一个 NSData 对象作为 responseObject

关于ios - -[_NSInlineData objectForKey :]: unrecognized selector sent to instance 0x7e351cc0',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30301006/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com