我使用AFNetworking在HTTPS上点击iOS 9上的参数,我的请求不是向服务器发送正确的参数。我已经把钥匙放进了一个plist中,而这并不适用于API。
发布于 2015-10-29 14:24:58
请记住,如果这在模拟器(Xcode 7/ is 9)上运行,您可能需要添加NSAppTransportSecurity > NSAllowsArbitraryLoads == YES key/value into your info.plist,以便与外界通信。这是第一个要求(只需确保您可以到达端点)。一旦做到这一点,您将需要使用任何API AFNetworking为您的目的提供。
发布于 2015-10-30 13:50:48
在Api期间,我将字典作为参数发送给problem.Solution以解决问题,如下所示
paraDict =
{
email ="xyz@abc.co"
password = "1234567"
}
make string of parameters
NSString *post = [NSString stringWithFormat:@"email=%@&password=%@"paraDict[@"email"],paraDict[@"password"]];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:postData];https://stackoverflow.com/questions/33415538
复制相似问题