1) 我正在我的印象笔记中一一保存一些 csv 文件,但我希望所有文件都在一个笔记本下。目前我正在默认笔记本下保存笔记,但我想要创建一个笔记本,然后我想在该笔记本中保存我的笔记
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/