Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:16:38+00:00 2026-06-01T09:16:38+00:00

i am developing an app which has a evernote integration,everything works perfect but my

  • 0

i am developing an app which has a evernote integration,everything works perfect but my problem is ,if i login with my account and uplode or downlode note to my aPP,then i logout from the evernote and login as a another user,it stills downlod and uplode note to previous account,,but login is sucess.
i put NsuserDefault for username and password textfileds and syncoronize it and pass it in evernote singlton shared class.my login looks like this

-(IBAction)_clickevernotelogin:(id)sender
{


    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    // Keep this key private
    NSString *consumerKey = [[[NSString alloc]
                              initWithString: @"myapp" ] autorelease];
    [[NSUserDefaults standardUserDefaults] setObject:consumerKey forKey:@"consumerkeyevrnote"];
    NSString *consumerSecret = [[[NSString alloc]
                                 initWithString: @"agft5623636"] autorelease];

    NSURL *userStoreUri = [[[NSURL alloc]
                            initWithString: @"https://www.evernote.com/edam/user"] autorelease];
    NSString *noteStoreUriBase = [[[NSString alloc]
                                   initWithString: @"https://www.evernote.com/edam/note/"] autorelease];

    // These are for test purposes. At some point the user will provide his/her own.
    NSString *username = [[[NSString alloc]
                           initWithString: _txtevernoteUsername.text] autorelease];
    NSString *password = [[[NSString alloc]
                           initWithString: _txtevernotepasswrd.text] autorelease];
        [[NSUserDefaults standardUserDefaults] setObject:_txtevernoteUsername.text forKey:@"usernameever"];
        [[NSUserDefaults standardUserDefaults] setObject:_txtevernotepasswrd.text forKey:@"passwrdevernote"];
         [[NSUserDefaults standardUserDefaults]synchronize];

    THTTPClient *userStoreHttpClient = [[[THTTPClient alloc]
                                         initWithURL:userStoreUri] autorelease];
    TBinaryProtocol *userStoreProtocol = [[[TBinaryProtocol alloc]
                                           initWithTransport:userStoreHttpClient] autorelease];
    EDAMUserStoreClient *userStore = [[[EDAMUserStoreClient alloc]
                                       initWithProtocol:userStoreProtocol] autorelease];
    EDAMNotebook* defaultNotebook = NULL;

    BOOL versionOk = [userStore checkVersion:@"Cocoa EDAMTest" :
                      [EDAMUserStoreConstants EDAM_VERSION_MAJOR] :
                      [EDAMUserStoreConstants EDAM_VERSION_MINOR]];

    if (versionOk == YES)
    {

        @try {

            NSError *error = nil;
            NSString *unameever = _txtevernoteUsername.text;

            NSString *pwdever   = _txtevernotepasswrd.text;


            [[NSUserDefaults standardUserDefaults] setObject:unameever forKey:@"usernameever"];
            BOOL flag = [SFHFKeychainUtils storeUsername:unameever andPassword:pwdever forServiceName:@"mybibleappever" updateExisting:TRUE error:&error];
            EDAMAuthenticationResult* authResult =
            [userStore authenticate:username :password
                                   :consumerKey :consumerSecret];
            EDAMUser *user = [authResult user];
            NSString *authToken = [authResult authenticationToken];
            NSLog(@"Authentication was successful for: %@", [user username]);
            NSLog(@"Authentication token: %@", authToken);
             [[NSUserDefaults standardUserDefaults] setObject:authToken forKey:@"usernameevernotetocken"];
            [[NSUserDefaults standardUserDefaults] setObject:[user username] forKey:@"usernameevernoteshow"]; 
            NSURL *noteStoreUri =  [[[NSURL alloc]
                                     initWithString:[NSString stringWithFormat:@"%@%@",
                                                     noteStoreUriBase, [user shardId]] ]autorelease];
        }
        @catch (EDAMUserException * e) {
            NSString * errorMessage = [NSString stringWithFormat:@"Please enter valid username & password", [e errorCode]];
            UIAlertView *alertDone = [[UIAlertView alloc] initWithTitle: @"Evernote" message: errorMessage delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
            _acteverloginimage.hidden = YES;
            _acteverlogin.hidden =YES;
            [alertDone show];
            [alertDone release];
            return;
        }


        [pool drain];


}

my logout looks like this

 [_btnusernameshow setTitle:nil forState:UIControlStateNormal];
            NSError *error = nil;
            NSString *usernameever = [[NSUserDefaults standardUserDefaults] objectForKey:@"usernameever"];
            BOOL flag = [SFHFKeychainUtils deleteItemForUsername:usernameever andServiceName:@"mybibleappever" error:&error];
            [[NSUserDefaults standardUserDefaults ]removeObjectForKey:@"usernameevernote"];
            [[NSUserDefaults standardUserDefaults ]removeObjectForKey:@"passwrdevernote"];
            [[NSUserDefaults standardUserDefaults ]removeObjectForKey:@"usernameevernotetocken"];
            [[NSUserDefaults standardUserDefaults ]removeObjectForKey:@"usernameever"];

my evernote singlton class which share the instance look like this
here i am passing the nsuerdefault value to change the authentication information to this class

- (void) connect {

    if (authToken == nil) 
    {      
        // In the case we are not connected we don't have an authToken
        // Instantiate the Thrift objects
        NSURL * NSURLuserStoreUri = [[[NSURL alloc] initWithString: userStoreUri] autorelease];

        THTTPClient *userStoreHttpClient = [[[THTTPClient alloc] initWithURL:  NSURLuserStoreUri] autorelease];
        TBinaryProtocol *userStoreProtocol = [[[TBinaryProtocol alloc] initWithTransport:userStoreHttpClient] autorelease];
        EDAMUserStoreClient *userStore = [[[EDAMUserStoreClient alloc] initWithProtocol:userStoreProtocol] autorelease];


        // Check that we can talk to the server
        bool versionOk = [userStore checkVersion: applicationName :[EDAMUserStoreConstants EDAM_VERSION_MAJOR] :    [EDAMUserStoreConstants EDAM_VERSION_MINOR]];

        if (!versionOk) {
            // Alerting the user that the note was created
            UIAlertView *alertDone = [[UIAlertView alloc] initWithTitle: @"Evernote" message: @"Incompatible EDAM client protocol version" delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];

            [alertDone show];
            [alertDone release];

            return;
        }


       NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
          [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(evrloginnotif:) name:@"evrloginnotiff" object:nil]; 
        //Checks if there is a saved User Name      
        NSError *error = nil;
        if([defaults objectForKey:@"usernameever"]&&[defaults objectForKey:@"passwrdevernote"])
        {


            username = [defaults objectForKey:@"usernameever"];
            password  = [defaults objectForKey:@"passwrdevernote"];

             //BOOL flag = [SFHFKeychainUtils storeUsername:username andPassword:password forServiceName:@"mybibleappever" updateExisting:TRUE error:&error];
            // Returned result from the Evernote servers after authentication
            EDAMAuthenticationResult* authResult =[userStore authenticate:username :password : consumerKey :consumerSecret];

            // User object describing the account
            self.user = [authResult user];
            // We are going to save the authentication token
            self.authToken = [authResult authenticationToken];
            // and the shard id
            self.shardId = [user shardId];

            // Creating the user's noteStore's URL
            noteStoreUri =  [[[NSURL alloc] initWithString:[NSString stringWithFormat:@"%@%@", noteStoreUriBase, shardId] ] autorelease];

            // Creating the User-Agent
            UIDevice *device = [UIDevice currentDevice];
            NSString * userAgent = [NSString stringWithFormat:@"%@/%@;%@(%@)/%@", applicationName,applicationVersion, [device systemName], [device model], [device systemVersion]]; 


            // Initializing the NoteStore client
            THTTPClient *noteStoreHttpClient = [[[THTTPClient alloc] initWithURL:noteStoreUri userAgent: userAgent timeout:15000] autorelease];
            TBinaryProtocol *noteStoreProtocol = [[[TBinaryProtocol alloc] initWithTransport:noteStoreHttpClient] autorelease];
            noteStore = [[[EDAMNoteStoreClient alloc] initWithProtocol:noteStoreProtocol] retain];

        }
    }
}

how to solve this bug,,thanks
EDIT

but when i rebuild the app,i am getting the correct notes from the username

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:16:39+00:00Added an answer on June 1, 2026 at 9:16 am
    NSUserDefaults *Test = [NSUserDefaults standardUserDefaults];
    
    [Test removeObjectForKey:@"usernameevernote"];
    [Test removeObjectForKey:@"passwrdevernote"];
    [Test removeObjectForKey:@"usernameevernotetocken"];
    [Test removeObjectForKey:@"usernameever"];
    [Test synchronize];
    

    maybe you should have remove objects and synchronize it again so it will remove all objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was developing app which uses Facebook API authentication for user login. But sometimes
I am developing an android app which has Facebook integration in it. I have
I'm developing an app which has a large amount of related form data to
Hy, I'm developing a Grails app which has to communicate with an existing Java
A Backbone app which I'm developing has a collection and a model, and associated
I'm developing an app that has a few services, which communicate using AIDL. In
OK let me explain the scenario. I am developing an app which has a
Im developing a app which has a user sign-up activity, there I need to
I am developing an app which has 9 image views in a 3x3 matrix.
I am developing an app which has a list view with custom layout as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.