繁体   English   中英

在Evernote SDK上访问标签

[英]Accessing Tags on Evernote SDK

我已经成功下载了示例项目中包含以下代码段的注释。

[[ENSession sharedSession] downloadNote:self.noteRef progress:^(CGFloat progress) {
    if (self.webView) {

    }
} completion:^(ENNote *note, NSError *downloadNoteError) {
    if (note && self.webView) {
        self.note = note;
        NSLog(@"%@", self.note.title);
        NSLog(@"%@", self.note.sourceUrl);

        NSLog(@"%lu", self.note.EDAMNote.tagNames.count);
        NSLog(@"%lu", self.note.tagNames.count);
        [self loadWebDataFromNote:note];
    } else {
        NSLog(@"Error downloading note contents %@", downloadNoteError);
    }
}];

标题正确时,tagNames数组返回nil。

有没有办法基于注释检索tagName?

干杯

我的名字叫埃里克·郑。 我是Evernote iOS SDK的首席工程师

阅读此https://github.com/evernote/evernote-cloud-sdk-ios/blob/master/evernote-sdk-ios/ENSDK/ENNote.h#L57-L63

我提供了ENNote类作为EDAMNote的简化版本,它是Evernote笔记的节俭类代表。 ENNote做的事情很简单,使开发人员更容易理解。 如果您想阅读便签上的标签,则应使用EDAM API,该API在此处列出https://github.com/evernote/evernote-cloud-sdk-ios/blob/master/evernote-sdk-ios/ENSDK /Advanced/ENNoteStoreClient.h#L518-L528

您可以编写如下代码:

ENSession * session = [ENSession sharedSession];
ENNoteStoreClient * noteStoreClient = [session noteStoreForNoteRef:noteRef];
[noteStoreClient getNoteTagNamesWithGuid:noteRef.guid success:^(NSArray *tags) {
        NSLog(@"Tag count: %@", [tags count]);
  } failure:^(NSError *error) {
        NSLog(@"Error in fetching tags %@ for note guid %@", error, noteRef.guid);
}];

您可以使用下面的代码来获取标签guid的列表。

ENSession * session = [ENSession sharedSession];
ENNoteStoreClient * noteStoreClient = [session noteStoreForNoteRef:noteRef];
[noteStoreClient getNoteWithGuid:noteRef.guid withContent:YES withResourcesData:NO withResourcesRecognition:NO withResourcesAlternateData:NO success:^(EDAMNote *note) {
    NSLog(@"tags guids: %@", note.tagGuids);
} failure:^(NSError *error) {

}];

然后获取Evernote标签列表并获取其名称。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM