菜鸟教程小白 发表于 2022-12-12 16:42:38

ios - 印象笔记 SDK : Cannot upload a note into my Sandbox account


                                            <p><p>我按照 Evernote github 教程“<a href="https://github.com/evernote/evernote-cloud-sdk-ios/blob/master/Getting_Started.md" rel="noreferrer noopener nofollow">https://github.com/evernote/evernote-cloud-sdk-ios/blob/master/Getting_Started.md</a>”将我的 iOS 应用程序中的笔记上传到 evernote。运行和构建后,我无法在我的沙盒帐户中创建笔记。</p>

<pre><code>//AppDelegate.m
#import &lt;ENSDK/ENSDK.h&gt;
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

// Initial development is done on the sandbox service
// When you want to connect to production, just pass &#34;nil&#34; for &#34;optionalHost&#34;
NSString *SANDBOX_HOST = ENSessionHostSandbox;

// Fill in the consumer key and secret with the values that you received from Evernote
// To get an API key, visit http://dev.evernote.com/documentation/cloud/
NSString *CONSUMER_KEY = @&#34;my_consumerkey&#34;;
NSString *CONSUMER_SECRET = @&#34;my_consumer_secret&#34;;

[ENSession setSharedSessionConsumerKey:CONSUMER_KEY
                        consumerSecret:CONSUMER_SECRET
                        optionalHost:SANDBOX_HOST];
}

//My EditTextController
#import &#34;EditTextController.h&#34;
#import &lt;ENSDK/ENSDK.h&gt;
@implementation EditTextController

- (void)viewDidLoad {
;
// Do any additional setup after loading the view.
;
_textEditor.font = ;
_textEditor.textColor = ;

//Initializing and creating ENNote and assigning a note content
ENNote * note = [ init];
note.content = ;
note.title = @&#34;My First Note&#34;;
[ uploadNote:note notebook:nil completion:^(ENNoteRef * noteRef, NSError * uploadNoteError) {
      if (uploadNoteError==nil) {
      NSLog(@&#34;Upload successful&#34;);
    }
    else
      NSLog(@&#34;Error%@&#34;,uploadNoteError);
}];
}
</code></pre>

<p>//错误是Domain=ENErrorDomain Code=2 "(null)"</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您似乎并未在此处实际验证任何用户。在调用 <code>-uploadNote:..</code> 方法之前,您需要对用户进行身份验证,以便 SDK 在调用服务时成功连接到特定用户的帐户。</p>

<p> <a href="https://github.com/evernote/evernote-cloud-sdk-ios/blob/master/Getting_Started.md#authenticate" rel="noreferrer noopener nofollow">Details are here</a>在 Github 上的入门文档中,但基本上你需要在 UI 中放置某种“连接到 Evernote”按钮并从那里调用 <code>-authenticateWithViewController...</code> 方法等。 </p>

<p>(如果您只是想测试一下,请尝试将其放入您的 <code>-viewDidLoad</code>(或 <code>-viewDidAppear</code>)方法中,并在它的完成 block 。)</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 印象笔记 SDK : Cannot upload a note into my Sandbox account,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/33186785/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/33186785/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 印象笔记 SDK : Cannot upload a note into my Sandbox account