无法使用Evernote IOS SDK下载笔记附件

我已经从github集成了最新的evernote ios sdk,支持普通用户和商业用户。 我可以列出笔记本和笔记没有任何问题,但是当我尝试下载笔记附件,它给了我下面的错误。

错误域= ENErrorDomain代码= 1“缺less结果:getResourceData失败:未知结果”UserInfo = 0x10dcb15f0 {NSLocalizedDescription =缺less结果:getResourceData失败:未知结果}跳过字段:由于types不匹配(收到:11)

这里我用来下载笔记附件的代码。

+ (void)downloadDataWithNoteBook:(ENNotebook *)notebook fromNoteResource:(EDAMResource *)resource onCompletion:(ZIdResultBlock)block { ENPreferencesStore *preference = [ENSession sharedSession].preferences; ENNoteStoreClient *noteStoreClient = [preference objectForKey:[SEEvernoteHelper getTitleForNoteAttachments:resource]]; NSString *str = resource.guid; NSLog(@"GUID = [%@]", resource.guid); [noteStoreClient getResourceDataWithGuid:resource.guid success:^(NSData *data) { if(block) { block(data, nil); } } failure:^(NSError *error) { if (block) { block(nil, error); }}]; } 

终于我能够做到了!

这是我的代码:

 //select the file that you want to download from evernote - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; isParentNoteBooks = false; if ([SEEvernoteHelper isNoteBookInstance:[self.datasourceObjects objectAtIndex:indexPath.row]]) { self.selectedNoteBook = [self.datasourceObjects objectAtIndex:indexPath.row]; [self fetchAttachmentsForNoteBook:[self.datasourceObjects objectAtIndex:indexPath.row]]; // set here if the notebook is business or not. if ([SEEvernoteHelper isBussinessNoteBook:self.selectedNoteBook]) { isCurrentNoteBookBusiness = YES; } else{ isCurrentNoteBookBusiness = NO; } } else { self.selectedFileNameToDownload = [SEEvernoteHelper getTitleForNoteAttachments:[self.datasourceObjects objectAtIndex:indexPath.row]]; self.selectedResource = [self.datasourceObjects objectAtIndex:indexPath.row]; [self downloadNoteResultObject:self.selectedResource]; } } //start the download process - (void)downloadNoteResultObject:(id)resultObject { MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; HUD.labelText = kStrDownloadingLabel; HUD.detailsLabelText = self.selectedFileNameToDownload; __weak __typeof__(self) weakSelf = self; [SEEvernoteHelper downloadDataWithNoteBook:self.selectedNoteBook fromNoteResource:resultObject onCompletion:^(id result, NSError *error) { if (result) { [NSThread syncOnMain:^{ //save the downloaded data.... [HUD hide:YES]; }]; } else { [HUD hide:YES]; [NSThread syncOnMain:^{ //error }]; } }]; } //get the download file + (void)downloadDataWithNoteBook:(ENNotebook *)notebook fromNoteResource:(EDAMResource *)resource onCompletion:(ZIdResultBlock)block { ENNoteStoreClient *noteStoreClient = [[ENSession sharedSession] noteStoreForNotebook:notebook]; [noteStoreClient getResourceWithGuid:resource.guid withData:YES withRecognition:NO withAttributes:YES withAlternateDate:NO success:^(EDAMResource *resource) { if(block) { block(resource.data.body, nil); } } failure:^(NSError *error) { NSLog(@"Error : %@",error); if (block) { block(nil, error); } }]; }