@
clowwindy 有个方法可以这样用:
[[EvernoteNoteStore noteStore] saveNewNoteToEvernoteApp:note withType:@"text/html"];
最终会调用 [[UIApplication sharedApplication] openURL:] 方法,HTML 当作 URL 的内容传给 Evernote for iOS 。
Evernote iOS SDK sample project 里完整代码是这样的:
if([[EvernoteSession sharedSession] isEvernoteInstalled]) {
NSString* filePath = [[NSBundle mainBundle] pathForResource:@"evernote_logo_4c-sm" ofType:@"png"];
NSData *myFileData = [NSData dataWithContentsOfFile:filePath];
NSData *dataHash = [myFileData enmd5];
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];
NSMutableArray *resources = [NSMutableArray arrayWithObjects:resource,resource, nil];
NSMutableArray *tagNames = [NSMutableArray arrayWithObjects:@"evernote",@"sdk", nil];
EDAMNote* note = [[EDAMNote alloc] initWithGuid:nil title:@"Test Note - Evernote SDK" content:@"<strong>Here is my new HTML note</strong>" contentHash:nil contentLength:0 created:0 updated:0 deleted:0 active:YES updateSequenceNum:0 notebookGuid:nil tagGuids:nil resources:resources attributes:nil tagNames:tagNames];
[[EvernoteSession sharedSession] setDelegate:self];
[[EvernoteNoteStore noteStore] saveNewNoteToEvernoteApp:note withType:@"text/html"];
}
else {
[self installEvernote:self];
}
如果没有安装 Evernote for iOS 会打开一个类 App Store 界面提示安装,也还算方便。