我将整个数据存储在zip file
中。
现在我想通过zip file
将my app
存储在Evernote中。
我有一些样本(通过谷歌搜索)使用这些样本我只能存储图像但我无法通过我的应用程序将zip file
存储在Evernote中。
请帮助有没有办法在evernote中存储zip文件
我正在使用以下代码发布图片及其说明
-(IBAction)authenticate:(id)sender
{
EvernoteSession *session = [EvernoteSession sharedSession];
[session authenticateWithViewController:self completionHandler:^(NSError *error) {
if (error || !session.isAuthenticated)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Could notauthenticate" delegate:nil
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
} else {
NSLog(@"authenticated! noteStoreUrl:%@ webApiUrlPrefix:%@", session.noteStoreUrl, session.webApiUrlPrefix);
}
}];
}`
-(IBAction)Postdata:(id)sender {
NSString* filePath = [[NSBundle mainBundle] pathForResource:@"setting_tablecell" ofType:@"png"];
NSData *myFileData = [NSData dataWithContentsOfFile:filePath];
NSData *dataHash = [myFileData md5];
EDAMData *edamData = [[EDAMData alloc] initWithBodyHash:dataHash size:myFileData.length body:myFileData];
EDAMResource* resource = [[EDAMResource alloc] initWithGuid:nil noteGuid:nil data:edamData mime:@"image/png" width:0 height:0 duration:0 active:0 recognition:0 attributes:nil updateSequenceNum:0 alternateData:nil];
NSString *noteContent = [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;\">Hello photo note.</span>"
"<br />"
"<span>Evernote logo :</span>"
"<br />"
"%@"
"</en-note>",[ENMLUtility mediaTagWithDataHash:dataHash mime:@"image/png"]];
NSMutableArray* resources = [NSMutableArray arrayWithArray:@[resource]];
EDAMNote *newNote = [[EDAMNote alloc] initWithGuid:nil title:@"Test photo note Nyt" content:noteContent contentHash:nil contentLength:noteContent.length created:0 updated:0 deleted:0 active:YES updateSequenceNum:0 notebookGuid:nil 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);
}];
}
答案 0 :(得分:1)
创建EDAMResource对象时,将mime类型更改为“application / zip”。
EDAMResource* resource = [[EDAMResource alloc] initWithGuid:nil noteGuid:nil data:edamData mime:@"application/zip" width:0 height:0 duration:0 active:0 recognition:0 attributes:nil updateSequenceNum:0 alternateData:nil];