简体   繁体   中英

Why don't my parameters get sent in my SLRequest?

I'm working with Twitter's API, and the parameters I try to send along an SLRequest seem to be ignored:

SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/home_timeline.json"] parameters:@{@"count":@50}];
[request setAccount:self.twitterAccount];
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {...}];

Here, although I give it a count=50 argument, I receive only 20 tweets. When I look at the connection using Charles Proxy, I don't see this argument sent anywhere in the request. Why doesn't SLRequest take my parameters into account?

It turns out the only type of parameters SLRequest accepts is NSString . So I should have sent @{@"count":@"50"} instead of @{@"count":@50} .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM