我目前正在使用Facebook登录我的iOS应用程序,服务器管理员最近添加了安全认证,要求使用Facebook访问令牌,并使所有连接通过https进行。这是我尝试运行的代码,但无论我做什么都会收到500(内部服务器错误)的服务器响应错误。有任何想法吗?
NSMutableURLRequest *request = [NSMutableURLRequest
requestWithURL:[NSURL URLWithString:@"https://XXXXXXXXXXXXXXXX/users.json"]];
NSDictionary *requestData = [[NSDictionary alloc] initWithObjectsAndKeys:
userID, @"facebook_id",
FBAccessToken, @"fb_token",
userName, @"name",
nil];
NSError *error;
NSData *postData = [NSJSONSerialization dataWithJSONObject:requestData options:0 error:&error];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:postData];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];