【问题标题】:Why don't my parameters get sent in my SLRequest?为什么我的参数没有在我的 SLRequest 中发送?
【发布时间】:2014-09-22 20:10:54
【问题描述】:

我正在使用 Twitter 的 API,我尝试通过 SLRequest 发送的参数似乎被忽略了:

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) {...}];

在这里,虽然我给它一个 count=50 参数,但我只收到 20 条推文。当我使用 Charles Proxy 查看连接时,我没有在请求中的任何地方看到此参数。为什么 SLRequest 不考虑我的参数?

【问题讨论】:

    标签: ios twitter slrequest


    【解决方案1】:

    事实证明SLRequest 接受的唯一参数类型是NSString。所以我应该发送@{@"count":@"50"} 而不是@{@"count":@50}

    【讨论】:

      猜你喜欢
      • 2017-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-17
      • 2019-08-11
      相关资源
      最近更新 更多