1

我想在 iOS6 社交框架上使用用户流。

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。请帮我:(

4

1 回答 1

2

使用 .preparedURLRequest。我终于在概述部分最后一段 的http://developer.apple.com/library/ios/#documentation/Social/Reference/SLRequest_Class/Reference/Reference.html中找到了它。

self.connection = [NSURLConnection connectionWithRequest:request.preparedURLRequest delegate:self];
于 2013-02-11T11:58:05.783 回答