我想通過我們的應用程序(圖像或文本或兩者)在「EverNote」中存儲一些數據。我想通過我們的應用程序在「EverNote」中存儲一些數據
我google了一下,我得到了一些像EverNote SDK的指導,我也得到了EverNoteCounter示例(當我運行這個,當我點擊getCount按鈕它顯示一條警告消息「無法驗證」)。 我也生成了開發者令牌。
但我無法創建consumerKey,consumerSecret。而且我也沒有找到如何從我們的應用程序存儲我們的數據到Evernote。
我喜歡this一個
一些鏈接,但是當我去通過鏈接它說(HTTP GET方法不受此URL支持)
我能與Evernote的身份驗證,我能獲取該賬戶中的筆記本數量。
我在我的應用程序中使用了sqllite。我爲圖像使用一個文件夾。 Sqllite有圖像鏈接信息。
如何存儲數據。
我用下面的代碼進行驗證,並得到計數
- (IBAction)retrieveUserNameAndNoteCount:(id)sender
{
// Create local reference to shared session singleton
EvernoteSession *session = [EvernoteSession sharedSession];
[session authenticateWithViewController:self completionHandler:^(NSError *error) {
// Authentication response is handled in this block
if (error || !session.isAuthenticated) {
// Either we couldn't authenticate or something else went wrong - inform the user
if (error) {
NSLog(@"Error authenticating with Evernote service: %@", error);
}
if (!session.isAuthenticated) {
NSLog(@"User could not be authenticated.");
}
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Error"
message:@"Could not authenticate"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease];
[alert show];
} else {
// We're authenticated!
EvernoteUserStore *userStore = [EvernoteUserStore userStore];
// Retrieve the authenticated user as an EDAMUser instance
[userStore getUserWithSuccess:^(EDAMUser *user) {
// Set usernameField (UILabel) text value to username
[usernameField setText:[user username]];
// Retrieve total note count and display it
[self countAllNotesAndSetTextField];
} failure:^(NSError *error) {
NSLog(@"Error retrieving authenticated user: %@", error);
}];
}
}];
}
- (void)countAllNotesAndSetTextField
{
// Allow access to this variable within the block context below (using __block keyword)
__block int noteCount = 0;
EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];
[noteStore listNotebooksWithSuccess:^(NSArray *notebooks) {
for (EDAMNotebook *notebook in notebooks) {
if ([notebook guid]) {
EDAMNoteFilter *filter = [[EDAMNoteFilter alloc] init];
[filter setNotebookGuid:[notebook guid]];
[noteStore findNoteCountsWithFilter:filter withTrash:NO success:^(EDAMNoteCollectionCounts *counts) {
if (counts) {
// Get note count for the current notebook and add it to the displayed total
NSNumber *notebookCount = (NSNumber *)[[counts notebookCounts] objectForKey:[notebook guid]];
noteCount = noteCount + [notebookCount intValue];
NSString *noteCountString = [NSString stringWithFormat:@"%d", noteCount];
[noteCountField setText:noteCountString];
}
} failure:^(NSError *error) {
NSLog(@"Error while retrieving note counts: %@", error);
}];
}
}
} failure:^(NSError *error) {
NSLog(@"Error while retrieving notebooks: %@", error);
}];
}
請給我建議的鏈接或者給我指導
感謝很多提前
是的..我遵循這些鏈接,我也得到了EverNoteTest示例..還有一個錯誤說「EDAMUserException:未知」身份驗證失敗。我還給出了消費者密鑰和密鑰@ Mustafa – Babul
您使用的是什麼主機名?您應該使用sandbox.evernote.com進行開發。如果您仍然看到問題,我會建議您在此處發佈您的問題:http://discussion.evernote.com/forum/61-evernote-for-developers/ – Mustafa
我正在使用沙盒帳戶。現在我在formus上發佈了這個問題。感謝您的回答@Mustafa – Babul