Login form for Evernote in ios
<p>i downloaed the evernote sample app from the evernote site for Iphone sdk.i integrated it with my application,i can save note to evernote and import back ,but the only problem is login form missing.the username and password is stored statically in the sample app.i dont know how to authenticate this to dynamically.it is using singlton desing.
in.h</p>

<pre><code>extern NSString * const  username; 
extern NSString * const  password;

@interface evernoteloginpage : UIViewController {
</code></pre>

<p>.m</p>

<pre><code>NSString * const username = @"nips55";
NSString * const password = @"annyan555";
@implementation evernoteloginpage
</code></pre>

<p>but i need it dynamically,i have two textfiled and a login button i need to add the textfiled values to username and password.i tried a lot but no luck.if anyone knows how to add a loginform for evernote ,please help me.
thanks in advance.
EDIT
now i sucessfully login with the help of this code,but again ther problem is if the login is sucess it will redirect  to next page as shown in the code,if the user enter the wrong username or password,ithe app crashes.how to handele the rror mamangement in this code.</p>

<pre><code>-(IBAction)_clickevernotelogin:(id)sender
{

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    // Keep this key private
    NSString *consumerKey = [[[NSString alloc]
                              initWithString: @"app" ] autorelease];
    [[NSUserDefaults standardUserDefaults] setObject:consumerKey forKey:@"consumerkeyevrnote"];
    NSString *consumerSecret = [[[NSString alloc]
                                 initWithString: @"12345678"] autorelease];
    // For testing we use the sandbox server.
    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:@"usernameevernote"];
    [[NSUserDefaults standardUserDefaults] setObject:_txtevernotepasswrd.text forKey:@"passwrdevernote"];

    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)
    {
        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);

        NSURL *noteStoreUri =  [[[NSURL alloc]
                                 initWithString:[NSString stringWithFormat:@"%@%@",
                                                 noteStoreUriBase, [user shardId]] ]autorelease];

        [pool drain];

   // this is next page if the login sucess

    evernotemainpage *detailViewController = [[evernotemainpage alloc] initWithNibName:@"evernotemainpage" bundle:nil];

    //detailViewController.firstString = firstString;
    // ...
    // Pass the selected object to the new view controller.

    [self.navigationController pushViewController:detailViewController animated:YES];

    [detailViewController release];
} 

}
</code></pre>
