我遵循Evernote github教程「https://github.com/evernote/evernote-cloud-sdk-ios/blob/master/Getting_Started.md」將我的iOS應用程序中的筆記上傳到evernote中。運行和構建後,我無法在我的沙盒帳戶中創建註釋。Evernote SDK:無法將筆記上傳到我的沙盒帳戶
//AppDelegate.m
#import <ENSDK/ENSDK.h>
@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 "nil" for "optionalHost"
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 = @"my_consumerkey";
NSString *CONSUMER_SECRET = @"my_consumer_secret";
[ENSession setSharedSessionConsumerKey:CONSUMER_KEY
consumerSecret:CONSUMER_SECRET
optionalHost:SANDBOX_HOST];
}
//My EditTextController
#import "EditTextController.h"
#import <ENSDK/ENSDK.h>
@implementation EditTextController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.textEditor setText:self.textstring];
_textEditor.font = [UIFont fontWithName:@"HelveticaNeue" size:24];
_textEditor.textColor = [UIColor blueColor];
//Initializing and creating ENNote and assigning a note content
ENNote * note = [[ENNote alloc] init];
note.content = [ENNoteContent noteContentWithString:self.textstring];
note.title = @"My First Note";
[[ENSession sharedSession] uploadNote:note notebook:nil completion:^(ENNoteRef * noteRef, NSError * uploadNoteError) {
if (uploadNoteError==nil) {
NSLog(@"Upload successful");
}
else
NSLog(@"Error%@",uploadNoteError);
}];
}
//錯誤是域名= ENErrorDomain代碼= 2「(空)」
與證書沒有問題。我剛剛生成了新的API密鑰並重復了相同的過程。 – WasimSafdar
什麼在你的'ENSession'實例上調用'isAuthenticated'產出?看起來像[這是檢查](https://github.com/evernote/evernote-cloud-sdk-ios/blob/master/evernote-sdk-ios/ENSDK/ENSession.m#L852),引發'ENErrorCodeAuthExpired '錯誤。 – heypiotr
錯誤不在isAuthenticated。我把斷點並檢查。這意味着它是驗證。 – WasimSafdar