I am trying to get facebook data using SLRequest iOS API, which seems to be working fine -
NSDictionary *parameters = @{};
NSURL *feedURL = [NSURL URLWithString:@"https://graph.facebook.com/me/home"];
SLRequest *feedRequest = [SLRequest
requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodGET
URL:feedURL
parameters:parameters];
feedRequest.account = facebookAccount;
[feedRequest performRequestWithHandler:^(NSData *responseData,
NSHTTPURLResponse *urlResponse, NSError *error)
{
// something
}];
However, following this I make an HTTP POST request to one of my servers,
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSData *requestData = [NSData dataWithBytes:[jsonData bytes] length:[jsonData length]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];
NSURLConnection *connection = [[NSURLConnection alloc]initWithRequest:request delegate:self];
which POSTS the data fine (verified from the server logs), but I do not get any HTTP response for it in
connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response
This used to be working fine without the SLRequest POST, and I am able to comment that piece out and it starts working again.
What am I missing here ?
How about you create an strong reference to your NSURLConnection, my guess that iOS is releasing that object, so that is why your delegate never get's called.
So, instead of:
Use:
Where:
Let me know how it goes, cheers.
Kind regards