首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何创建笔记本并将我的笔记保存到该笔记本中?

如何创建笔记本并将我的笔记保存到该笔记本中?
EN

Stack Overflow用户
提问于 2013-04-12 15:51:03
回答 2查看 612关注 0票数 4

1)我正在将一些csv文件逐个保存在我的evernote中,但我希望所有文件都在一个笔记本下。目前,我将笔记保存在默认笔记本下,但我希望创建一个笔记本,然后将笔记保存在该笔记本中

2)目前,我正在将csv文件转换为数据,以便它显示一些附件后,它再次显示csv文件

但是如何将文件直接保存到evernote而不是将其转换为数据呢?我正在使用下面的代码

代码语言:javascript
复制
NSData *NewdataHash = [NewFileData md5];
    EDAMData *NewedamData = [[EDAMData alloc] initWithBodyHash:NewdataHash size:NewFileData.length body:NewFileData];
    EDAMResource* Newresource = [[EDAMResource alloc] initWithGuid:nil noteGuid:nil data:NewedamData mime:@"application/csv" width:0 height:0 duration:0 active:0 recognition:0 attributes:nil updateSequenceNum:0 alternateData:nil];
    NSString *NewnoteContent = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                                  "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">"
                                  "<en-note>"
                                  "<span style=\"font-weight:bold;\">CountDown DairiesList.</span>"
                                  "<br />"
                                  "<span>Evernote logo :</span>"
                                  "<br />"
                                  "%@"
                                  "</en-note>",[ENMLUtility mediaTagWithDataHash:NewdataHash mime:@"application/csv"]];

    NSMutableArray* Newresources = [NSMutableArray arrayWithArray:@[Newresource]];

    EDAMNote *NewnewNote = [[EDAMNote alloc] initWithGuid:nil title:@"DairiesList CSV" content:NewnoteContent contentHash:nil contentLength:NewnoteContent.length created:0 updated:0 deleted:0 active:YES updateSequenceNum:0 notebookGuid:nil tagGuids:nil resources:Newresources attributes:nil tagNames:nil];
    [[EvernoteNoteStore noteStore] createNote:NewnewNote success:^(EDAMNote *note)
     {   

       }  

      failure:^(NSError *error) {
 }];
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-04-17 13:20:58

代码语言:javascript
复制
 EDAMNotebook* notebook = [[EDAMNotebook alloc] initWithGuid:nil name:eObj.title updateSequenceNum:0 defaultNotebook:NO serviceCreated:0 serviceUpdated:0 publishing:nil published:NO stack:nil sharedNotebookIds:nil sharedNotebooks:nil businessNotebook:nil contact:nil restrictions:nil]; 

[noteStore createNotebook:notebook success:^(EDAMNotebook *notebook)  
{
 NSData *NewdataHash = [NewFileData md5];
    EDAMData *NewedamData = [[EDAMData alloc] initWithBodyHash:NewdataHash size:NewFileData.length body:NewFileData];
    EDAMResource* Newresource = [[EDAMResource alloc] initWithGuid:nil noteGuid:nil data:NewedamData mime:@"application/csv" width:0 height:0 duration:0 active:0 recognition:0 attributes:nil updateSequenceNum:0 alternateData:nil];
    NSString *NewnoteContent = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                                  "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">"
                                  "<en-note>"
                                  "<span style=\"font-weight:bold;\">CountDown DairiesList.</span>"
                                  "<br />"
                                  "<span>Evernote logo :</span>"
                                  "<br />"
                                  "%@"
                                  "</en-note>",[ENMLUtility mediaTagWithDataHash:NewdataHash mime:@"application/csv"]];

    NSMutableArray* Newresources = [NSMutableArray arrayWithArray:@[Newresource]];
                                   EDAMNote *newNote = [[EDAMNote alloc] initWithGuid:notebook.guid title:titileString content:noteContent contentHash:nil contentLength:noteContent.length created:0 updated:0 deleted:0 active:YES updateSequenceNum:notebook.updateSequenceNum notebookGuid:notebook.guid tagGuids:nil resources:resources attributes:nil tagNames:nil];

                                  [[EvernoteNoteStore noteStore] createNote:newNote success:^(EDAMNote *note)
                                   {
                                       NSLog(@"Note created successfully.");


                                   } failure:^(NSError *error) {
                                       NSLog(@"Error creating note : %@",error);
                                   }];


  }
                 failure:^(NSError *error)
                  {

                      NSLog(@"Error : %@",error);
                   }];
票数 2
EN

Stack Overflow用户

发布于 2013-04-13 15:27:25

要在记事本中保存便笺,只需设置您创建的EDAMNote对象的notebookGuid即可。您需要转换为NSData来存储csv文件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15965882

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档