私はこの1頭で本当に頭が痛いです。私は、ユーザーが自分のアプリケーションからのPocket記事をアーカイブできるようにPocket APIを使用していますが、私は以下のコードでこれを行うにしようとするたびに私はこのエラーを取得する:Objective-C用のPocket APIでアーカイブコマンドが失敗する原因となっている問題は何ですか?
Error Domain=PocketSDK Code=400 "Invalid request, please refer to API documentation" UserInfo=0xc17d3b0 {NSLocalizedDescription=Invalid request, please refer to API documentation}
コード:
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.");
}
}];
を正確にその部分は間違っていますか?私はAPIにsendメソッドをポストしていませんか?
編集:私も持っているし、それを変更し@"action"
@"actions"
こととNSDictionaryの上にそれを供給するために、それは...
EDITをエラーなしで返しますが、ポケットのウェブサイト上で、それには影響しません2:返し
// 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);
}
}];
:ジョセフ・チェンの応答当たりのIを次のように私のコードを変更し
action_results" = (
1
);
status = 1;
まだ私がウェブサイトにアクセスしてログインすると、アーカイブされた記事は、まだアーカイブされていない状態で私を見つめています。
は、パケットをキャプチャし、それをここに投稿するWiresharkのようなプログラムを使用してみてください。 – 0xcaff