我尝试使用的 API 在检索时返回乱码 XML。
这是将身份验证参数发布到端点的基本代码。
[[APIManager sharedManager] postPath:@"Authenticate"
parameters:params
success:^(AFHTTPRequestOperation *operation, XMLParser *xmlParser ) {
//code
NSLog(@"Raw XML Data: %@", [[NSString alloc] initWithData:operation.responseData encoding:NSUTF8StringEncoding]);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//code
DLog(@"error: %@", error);
}];
我得到的响应是这样的乱码:
Raw XML Data: <?xml version="1.0" encoding="utf-8"?><string xmlns="http://www.morningstarsoftware.com/"><MorningStar_BCE_WS><MyUserInfo><Tenant_Id>37</Tenant_Id><MsClient>OBC05</MsClient><Suite_Location>DA</Suite_Location><pseq>6690</pseq><CPResetAccess>false</CPResetAccess><CCPayor>N</CCPayor><CPAllowFinancial>false</CPAllowFinancial><CPAllowScheduler>true</CPAllowScheduler><CPAllowService>false</CPAllowService><FirstName>Gary</FirstName><LastName>Evans</LastName><OfferCC>Y</OfferCC><AllowACH>Y</AllowACH><MerchantAccount>121513</MerchantAccount><SQID>0</SQID><SQID2>0</SQID2><Ecom_payment_recurring /></MyUserInfo></MorningStar_BCE_WS></string>
我做错了什么,还是 API 只是错误地返回了这个?