I would like to edit the data saved at Pocket using Pocket API with iOS SDK. However, although the preparation method is tried, no response and error also come on the contrary.
As a premise
- URLs can be added using other API (saveURL).
- Permissions of the registered application are 'Add' and 'Modify'.
Is there any advice? Thanks.
NSError* error;
NSArray *actions = @[@{ @"action": @"delete", @"item_id": @"456853615" }];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject: actions
options: kNilOptions
error: &error];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding: NSUTF8StringEncoding];
// On ios simulator access_token is saved in NSUserDefaults, but on device in keychain.
// see https://github.com/Pocket/Pocket-ObjC-SDK/blob/master/SDK/PocketAPI.m#L718
NSString *accessToken = [[NSUserDefaults standardUserDefaults] objectForKey: @"PocketAPI.token"];
NSDictionary* argumentDictionary = @{@"consumer_key": @"<MY_CONSUMER_KEY>",
@"access_token": accessToken,
@"actions": jsonString};
[[PocketAPI sharedAPI] callAPIMethod: @"v3/send"
withHTTPMethod: PocketAPIHTTPMethodPOST
arguments: argumentDictionary
handler: ^(PocketAPI *api, NSString *apiMethod, NSDictionary *response, NSError *error){
NSLog(@"response %@", [response description]); // response (null)
NSLog(@"error %@", [error localizedDescription]); // response (null)
}];