我是Twitter Streaming API的新手!
目前我正在尝试实施Twitter Streaming API以获取所需位置的公开信息:
- (void)test
{
NSURL *url = [NSURL URLWithString:@"https://stream.twitter.com/1.1/statuses/sample.json"];
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:url parameters:nil];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:[request preparedURLRequest] delegate:self startImmediately:NO];
[connection scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
[connection start];
}
在NSURLConnectionDelegate回调didReceiveData:我总是得到null响应。我的问题在哪里?如何使它工作?