iphone - 如何创建笔记本并将我的笔记保存在该笔记本中?

标签 iphone objective-c ios6 evernote

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

i want like this

2) 目前,我正在将该 csv 文件转换为数据,因此它会在再次显示 csv 文件后显示一些附加文件

但如何将文件直接保存到印象笔记而不将其转换为数据? 我正在使用以下代码

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) {
 }];

最佳答案

 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);
                   }];

关于iphone - 如何创建笔记本并将我的笔记保存在该笔记本中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15965882/

相关文章:

iPhone(iOS): copying files from main bundle to documents folder error

iphone - 如何避免 NSDictionary 中出现 UTF8 字符?

objective-c - Objective-C 属性的默认属性是什么?

iPhone Cocos2D - 将 float 转换为 GLubyte

iphone - 从字典数组创建值数组

ios - 我想在 ios 中加载图像之前显示事件指示器

objective-c - 类似于 Objective-C 中的 Java 注释

ios - 将自定义按钮添加到 UINavigationController 子类中

iphone - iOS6:如何通过Identifier连接Storyboard中的UIViewController?

ios - 为什么我的标签栏 Controller 从与事件 View Controller 不同的 View Controller 执行代码?