我想在iOS6社交框架上使用userstream。
的iOS5
TWRequest *request = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"https://userstream.twitter.com/1.1/user.json"] parameters:params requestMethod:TWRequestMethodGET];
[request setAccount:account];
self.connection = [NSURLConnection connectionWithRequest:request.signedURLRequest delegate:self];
[self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[self.connection start];
iOS6的
SLRequest* request = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:@"https://userstream.twitter.com/1.1/user.json"] parameters:params];
[request setAccount:account];
self.connection = [NSURLConnection connectionWithRequest:request.signedURLRequest delegate:self];//signedURLRequest cannot use
[self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[self.connection start];
我想在iOS6上使用signedURLRequest。 请帮帮我:(
答案 0 :(得分:2)
使用.preparedURLRequest。我终于在概述部分的http://developer.apple.com/library/ios/#documentation/Social/Reference/SLRequest_Class/Reference/Reference.html中找到了它,最后一段。
self.connection = [NSURLConnection connectionWithRequest:request.preparedURLRequest delegate:self];