使用Evernote API创建注释

时间:2012-11-06 18:43:13

标签: iphone api evernote

EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];
EDAMNote *note = [[EDAMNote alloc] init];
[note setTitle:@"Test Note from EvernoteCounter for iPhone"];
[note setContent:[ [NSString alloc] initWithFormat:@"<en-note>%@</en-note>",@"tete"];
[noteStore createNote:(note) success:^(EDAMNote *note) {
    NSLog(@"Received note guid: %@", [note guid]);
}failure:^(NSError *error) {
    NSLog(@"Create note failed: %@", error);
}];

我使用此代码通过evernote激活createNote。但是createNote没有返回任何值 - 它被困在一个名为async的内部api函数中。有没有人试图在iOS的SDK上使用API​​创建一个新笔记,并且实际上在他们的Evernote帐户上得到了注释?

2 个答案:

答案 0 :(得分:0)

我们刚刚添加了一些新的示例代码来创建照片备注。请查看:https://github.com/evernote/evernote-sdk-ios。创建笔记的正确方法是使用:

- (id) initWithGuid: (EDAMGuid) guid title: (NSString *) title content: (NSString *) content contentHash: (NSData *) contentHash contentLength: (int32_t) contentLength created: (EDAMTimestamp) created updated: (EDAMTimestamp) updated deleted: (EDAMTimestamp) deleted active: (BOOL) active updateSequenceNum: (int32_t) updateSequenceNum notebookGuid: (NSString *) notebookGuid tagGuids: (NSArray *) tagGuids resources: (NSArray *) resources attributes: (EDAMNoteAttributes *) attributes tagNames: (NSArray *) tagNames;

另请参阅:http://dev.evernote.com/documentation/reference/Types.html#Struct_Note了解更多信息。

答案 1 :(得分:0)

Sample code for u. @KatieK
// --------------------------------

EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];
    EDAMNote *note = [[EDAMNote alloc] init];
    [note setTitle:@"Hello Evernote"];
    [note setContent:[[NSString alloc] initWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\"><en-note>Hello, world! %@</en-note>",@"I'm LongPham"]];


    [noteStore createNote:note success:^(EDAMNote *note) {
        NSLog(@"Received note guid: %@", [note guid]);
    }failure:^(NSError *error) {
        NSLog(@"Create note failed: %@", error);
    }];