Вопрос

I want use userstream on iOS6 social framework.

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];

I want to use signedURLRequest on iOS6. please help me:(

Это было полезно?

Решение

Use .preparedURLRequest. I finally found it in http://developer.apple.com/library/ios/#documentation/Social/Reference/SLRequest_Class/Reference/Reference.html in the overview section, last paragraph.

self.connection = [NSURLConnection connectionWithRequest:request.preparedURLRequest delegate:self];
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top