Ios 我可以使用TwitterKit访问Twitter';什么是流媒体API?
我已经在我的Xcode项目中设置了TwitterKit。我使用的是Objective C,我可以通过ID成功访问Tweets,并查询REST API。然而,我想使用流式API,而文档并没有明确说明我是否可以进行流式处理,比如对于包含单词“space”的tweet 使用下面的代码,我永远不会得到响应对象。如有任何帮助,将不胜感激:Ios 我可以使用TwitterKit访问Twitter';什么是流媒体API?,ios,objective-c,twitter,Ios,Objective C,Twitter,我已经在我的Xcode项目中设置了TwitterKit。我使用的是Objective C,我可以通过ID成功访问Tweets,并查询REST API。然而,我想使用流式API,而文档并没有明确说明我是否可以进行流式处理,比如对于包含单词“space”的tweet 使用下面的代码,我永远不会得到响应对象。如有任何帮助,将不胜感激: NSString *statusesShowEndpoint = @"https://stream.twitter.com/1.1/statuses/sample.js
NSString *statusesShowEndpoint = @"https://stream.twitter.com/1.1/statuses/sample.json";
NSDictionary *params = @{};
NSError *clientError;
NSURLRequest *request = [[[Twitter sharedInstance] APIClient]
URLRequestWithMethod:@"POST"
URL:statusesShowEndpoint
parameters:params
error:&clientError];
if (request) {
[[[Twitter sharedInstance] APIClient]
sendTwitterRequest:request
completion:^(NSURLResponse *response,
NSData *data,
NSError *connectionError) {
NSLog(@"response0 %@", response);
if (data) {
// handle the response data e.g.
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization
JSONObjectWithData:data
options:0
error:&jsonError];
NSLog(@"json %@", json);
NSLog(@"response1 %@", response);
}
else {
NSLog(@"Error1: %@", connectionError);
NSLog(@"response2 %@", response);
}
}];
}
else {
NSLog(@"Error: %@", clientError);
}