So, I'm currently using Facebook to log in to the iOS app, and the server administrator recently added security authentication, requiring a Facebook access token, and all connections go through https. Here's the code I tried to run, but I get a 500 server response error (internal server error) no matter what I do. Any ideas?
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];
Julian Coltea
source share