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 6062847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:05:54+00:00 2026-05-23T09:05:54+00:00

hi friend i am passing tokenid throw this class to this here is my

  • 0
hi friend i am passing tokenid throw this class to this here is my code how i am passing it wrong for 



-(void)check
{
    //app.journeyList = [[NSMutableArray alloc]init];
    [self createEditableCopyOfDatabaseIfNeeded];

    NSString *filePath = [self getWritableDBPath];

    sqlite3 *database;

    if(sqlite3_open([filePath UTF8String], &database) == SQLITE_OK) {
        const char *sqlStatement = "SELECT Username,Password FROM UserInformation where Username=? and Password=?";
        sqlite3_stmt *compiledStatement;
        if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)    {
            sqlite3_bind_text(compiledStatement, 1, [txtUserName.text UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(compiledStatement, 2, [txtPassword.text UTF8String], -1, SQLITE_TRANSIENT);
            //NSString *loginname= [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
            //          NSString *loginPassword = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];




        }
        if(sqlite3_step(compiledStatement) != SQLITE_ROW ) {
            NSLog( @"Save Error: %s", sqlite3_errmsg(database) );
            UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"User is not valid" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert show];
            [alert release];
            alert = nil;

            //We have no data in database so send request to webserver.
            //apitest = [[UIApplication sharedApplication]delegate];
            //if (apitest.internetConnectionStatus != NotReachable)
//          {
//              [self sendRequest];
//          }
        }
        else {

            isUserValid = YES;
            if (isUserValid) {
                UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"Valid User" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
                [alert show];
                [alert release];

            }       
        }

        sqlite3_finalize(compiledStatement);
    }
    sqlite3_close(database);        
}



-(IBAction)update:(id)sender
{
    test1  *check = [[test1 alloc]initWithNibName:@"test1" bundle:nil];
    check.tokenapi1=tokenapi;;
    [self presentModalViewController:check animated:YES];
    //[self getStudents];
}















-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 
{   
    [webData setLength: 0]; 
} 

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 
{         
    [webData appendData:data]; 

} 

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error 
{     
    [connection release];  
    [webData release]; 

} 

-(void)connectionDidFinishLoading:(NSURLConnection *)connection 
{      
    NSString *loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding]; 
    NSLog(@"%@",loginStatus);  


    //this is to perfrom insert opertion on the userinformation table

    NSString *json_string = [[NSString alloc] initWithData:webData encoding:NSUTF8StringEncoding]; 

    NSDictionary *result = [json_string JSONValue];

    tokenapi = [result objectForKey:@"TokenID"];
    NSLog(@"this is token id:%@",tokenapi);
    //
    BOOL errortest = [[result objectForKey:@"isError"] boolValue];
    if(errortest == FALSE)
    {
     values = [result objectForKey:@"Result"];
        NSLog(@"Valid User");
    }
    else
    {
        NSLog(@"Invalid User");
    }

    NSMutableArray *results = [[NSMutableArray alloc] init];

     for (int index = 0; index<[values count]; index++) {
     NSMutableDictionary * value = [values objectAtIndex:index];
     Result * result = [[Result alloc] init];
     result.UserID = [value objectForKey:@"UserId"];
     result.FirstName = [value objectForKey:@"FirstName"];
     result.LastName =[value objectForKey:@"LastName"];
     result.Email =[value objectForKey:@"Email"];
     result.ProfileImage =[value objectForKey:@"ProfileImage"];
     result.ThumbnailImage =[value objectForKey:@"ThumbnailImage"];
     result.DeviceInfoId =[value objectForKey:@"DeviceInfoId"];
     NSLog(@"%@",result.UserID);
         ID=result.UserID;
      NSLog(@"%@",ID);
     [results addObject:result];
     [result release]; 
     }



     for (int index = 0; index<[results count]; index++) {
     Result * result = [results objectAtIndex:index];
     //save the object variables to database here


     [self createEditableCopyOfDatabaseIfNeeded];

     NSString *filePath = [self getWritableDBPath];

     sqlite3 *database;
     //NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970]; 
//   NSNumber *timeStampObj = [NSNumber numberWithInt: timeStamp];
//   NSLog(@"%@",timeStampObj);
//   NSString *journeyid = [NSString stringWithFormat:@"%@_%@_%@", result.UserID, result.DeviceInfoId, timeStampObj];
     if(sqlite3_open([filePath UTF8String], &database) == SQLITE_OK) {
     const char *sqlStatement = "insert into UserInformation(UserID,DeviceId,Username,Password,FirstName,Email) VALUES (?,?,?,?,?,?)";
     sqlite3_stmt *compiledStatement;
     if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)    {
     //sqlite3_bind_text( compiledStatement, 1, [journeyid UTF8String],-1,SQLITE_TRANSIENT);
     sqlite3_bind_text( compiledStatement, 1, [result.UserID UTF8String],-1,SQLITE_TRANSIENT);
     sqlite3_bind_text(compiledStatement, 2, [result.DeviceInfoId UTF8String],-1,SQLITE_TRANSIENT);
     sqlite3_bind_text(compiledStatement, 3, [txtUserName.text UTF8String],-1,SQLITE_TRANSIENT);
     sqlite3_bind_text(compiledStatement, 4, [txtPassword.text UTF8String],-1,SQLITE_TRANSIENT);
     sqlite3_bind_text (compiledStatement, 5, [result.FirstName UTF8String],-1,SQLITE_TRANSIENT);
     sqlite3_bind_text (compiledStatement, 6, [result.Email UTF8String],-1,SQLITE_TRANSIENT);

     }
     if(sqlite3_step(compiledStatement) != SQLITE_DONE ) {
     NSLog( @"Save Error: %s", sqlite3_errmsg(database) );
     }
     else {
     UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"Record added" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
     [alert show];
     [alert release];
     alert = nil;
     }

     sqlite3_finalize(compiledStatement);
     }
     sqlite3_close(database);   





     }

    [loginStatus release];           
    [connection release];  
    [webData release]; 
} 


-(IBAction)click:(id)sender
{

    [self sendRequest];
    //this is to select username and password from database.
    [self check];




}




this where i am passing then token id using for updat userprofile with tokinid but it not taken here it show error in console it show tokenid invalid i thing i have to pass user id also for update vale as refrence for tokenid
  • 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-05-23T09:05:54+00:00Added an answer on May 23, 2026 at 9:05 am

    You should use the Delegate pattern for passing a value from one class to others.

    See the below SO post.

    How do I set up a simple delegate to communicate between two view controllers?

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

Sidebar

Related Questions

A friend show me this sample code to implement HTTP POST in C# and
My friend and I were discussing the other day which style of code is
My friend done this below coding for custom control <a href=javascript:__doPostBack('id','msg');>click</a> now i want
I just got referred to stackoverflow by a friend here to help with a
[I have some code to create a JSON array. In this code I am
I'm writing an app for a friend but I ran into a problem, the
i am using a user id , friend id , page and passing the
Short story. This site was created by a friend of mine, who did not
I came across a function with this signature. void foo(char (&x)[5]) { } This
I think this question is best asked with a small code snippet I just

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.