我对使用Objective-C的Pocket API导致归档命令失败的错误是什么?

Dou*_*ith 6 api objective-c ios pocket

我真的在这个问题上摸不着头脑.我正在使用Pocket API允许用户从我的应用程序存档Pocket文章,但每当我尝试使用以下代码时,我会收到此错误:

错误域= PocketSDK代码= 400"请求无效,请参阅API文档"UserInfo = 0xc17d3b0 {NSLocalizedDescription =无效请求,请参阅API文档}

码:

          NSDictionary *arguments = @{@"action": @"archive",
                                                 @"item_id": articleID};

          [[PocketAPI sharedAPI] callAPIMethod:@"send" withHTTPMethod:PocketAPIHTTPMethodPOST arguments:arguments handler:^(PocketAPI *api, NSString *apiMethod, NSDictionary *response, NSError *error) {
                if (!error) {
                     NSLog(@"Archived article.");
                }
          }];
Run Code Online (Sandbox Code Playgroud)

究竟哪一部分不正确?我不是将发送方法发布到API吗?

编辑:我甚至改变它有@"action"@"actions"和提供它上面的NSDictionary,并返回没有错误,但并不影响它的掌上网站上...

编辑2:根据Joseph Chen的回复,我将代码更改为以下内容:

      // Create data to pass to the Pocket API (a JSON array of actions)
      NSError *error;
      NSArray *actions = @[@{@"action": @"archive",
                                    @"item_id": articleID}];
      NSData *actionsAsJSONData = [NSJSONSerialization dataWithJSONObject:actions options:kNilOptions error:&error];
      NSString *actionsAsJSONString = [[NSString alloc] initWithData:actionsAsJSONData encoding:NSUTF8StringEncoding];

      NSDictionary *arguments = @{@"actions": actionsAsJSONString};

      [[PocketAPI sharedAPI] callAPIMethod:@"send" withHTTPMethod:PocketAPIHTTPMethodPOST arguments:arguments handler:^(PocketAPI *api, NSString *apiMethod, NSDictionary *response, NSError *error) {
            if (!error) {
                 NSLog(@"%@", response);
            }
            else {
                 NSLog(@"%@", error);
            }
      }];
Run Code Online (Sandbox Code Playgroud)

哪个回报:

action_results" =     (
    1
);
status = 1;
Run Code Online (Sandbox Code Playgroud)

然而,当我进入网站并登录时,我"存档"的文章仍然盯着我,没有归档.

Are*_*lko 1

这是(几乎)直接从我的应用程序获取的代码:

NSTimeInterval timestamp = [[NSDate date] timeIntervalSince1970];
NSDictionary *arguments = @{@"actions" : @[@{@"action" : @"archive",
                                             @"item_id" : itemId,
                                             @"time" : [NSString stringWithFormat:@"%ld", (long)timestamp]}]};

[self.pocketAPI callAPIMethod:@"send"
               withHTTPMethod:PocketAPIHTTPMethodPOST
                    arguments:arguments
                      handler:^(PocketAPI *api, NSString *apiMethod, NSDictionary *response, NSError *error)
 {
     if (!error) {
         // OK
     } else {
         // handle error
     }
 }];
Run Code Online (Sandbox Code Playgroud)