我正在尝试使用 SLRequest iOS API 获取 facebook 数据,这似乎工作正常 -
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
}];
但是,在此之后,我向我的一台服务器发出 HTTP POST 请求,
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];
POST数据很好(从服务器日志验证),但我没有得到任何HTTP响应
connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response
在没有 SLRequest POST 的情况下,这曾经可以正常工作,我可以评论该部分并再次开始工作。
我在这里想念什么?