4

1) いくつかの csv ファイルを evernote に 1 つずつ順番に保存していますが、すべてのファイルを 1 つのノートブックにまとめたいです。現在、デフォルトのノートブックにメモを保存していますが、ノートブックを作成してから、そのノートブックにメモを保存したい

私はこのようにしたい

2)現在、そのcsvファイルをデータに変換しているため、csvファイルを再度表示した後、添付ファイルが表示されます

しかし、ファイルをデータに変換せずに直接 evernote に保存するにはどうすればよいでしょうか? 次のコードを使用しています

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

2 に答える 2

2
 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);
                   }];
于 2013-04-17T05:20:57.957 に答える
1

メモをノートブックに保存するには、作成notebookGuidしたEDAMNoteオブジェクトの を設定するだけです。csv ファイルを保存するには、NSData に変換する必要があります。

于 2013-04-13T07:27:24.977 に答える