iphone - 我想通过我们的应用程序在 "EverNote"中存储一些数据

标签 iphone objective-c ios evernote

我想通过我们的应用程序在“EverNote”中存储一些数据(图像或文本或两者)。

我用 google 搜索,得到了一些指导,例如 EverNote SDK,并且还得到了 EverNoteCounter 示例(当我运行此示例时,当我单击 getCount 按钮时,它会显示一条警报消息“无法验证”)。 我还生成了开发者 token 。

但我无法创建consumerKey,consumerSecret。而且我也没有找到如何从我们的应用程序将数据存储到 Evernote。

我得到了一些链接,例如 this一个

但是当我浏览该链接时,它说(此 URL 不支持 HTTP 方法 GET)

我能够通过 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);
    }];
}

请向我建议链接或给我指导

提前非常感谢

最佳答案

当您只需要访问自己的帐户时,可以使用开发者 token 。要获取消费者 key / secret ,请转到此处:http://dev.evernote.com/documentation/cloud/ .

如果您使用的是 iOS,https://github.com/evernote/evernote-sdk-ios有一个示例应用程序,一旦您拥有消费者 key 和 secret ,您就可以使用该应用程序。

总的来说,dev.evernote.com 上有很多信息。

所有 SDK 均位于 https://github.com/evernote

iOS 入门指南:http://blog.evernote.com/tech/2012/05/24/evernote-sdk-integration-ios/

关于iphone - 我想通过我们的应用程序在 "EverNote"中存储一些数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14052708/

相关文章:

iphone - 将 JSON 数据写入磁盘

iOS Setters 和 Getters 以及带下划线的属性名称

ios - UIBarButtonItem 自定义背景外观 'Jumping' 翻转过渡后

ios - session (_ :activationDidCompleteWith:error:) not called on Apple Watch (but is called in Simulator)

iphone - 如何比较图像字符串(名称?)并更改图像

iphone - 在 Interface Builder (XCode 4) 中设置 UIButton 拉伸(stretch)背景图像

ios - 带有自定义提示的 AVAudioSession requestRecordPermission?

iOS 命令行构建 : How to create xcode archive from command line?

iphone - UITabBarItem appearance -setTitleTextAttributes 不断记录 "state = 1 is interpreted as UIControlStateHighlighted"?

ios - Objective-C 随机数