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

  • Home
  • SEARCH
  • 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 6540385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:58:20+00:00 2026-05-25T10:58:20+00:00

I am trying to sync the data from iPhone to server but didn’t get

  • 0

I am trying to sync the data from iPhone to server but didn’t get it. I was doing this before in the last four days but not getting any success now. It shows

  1. ** that Connection failed! Error – The request timed out.
    http://192.168.0.68:91/JMAPI?RequestType=User&Command=NEW
  2. ** -[NSConcreteMutableData release]: message sent to deallocated
    instance 0x165590a0

My server is create with help of C#
And I have the local server link like this http://192.168.0.68:91/JMAPI
For posting the data I code like this

    -(void)sendRequest

    {

        NSDate* date = [NSDate date];
        //Create the dateformatter object
        NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
        //Set the required date format
        [formatter setDateFormat:@"yyyy-MM-dd HH:MM:SS"];
        //Get the string date
        NSString* str = [formatter stringFromDate:date];

        NSString *post = [NSString stringWithFormat:@"Token=%@&JourneyID=%@&JourneyName=%@&Locationname=%@&StartDate=%@&Distance=%@&ShareType=%@&LastSyncDate=%@",tokenapi,Journey_ID,Journey_Name,Location_Name,Start_Date,Dist,Share_type,str];
        NSLog(@"%@",post);
        NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; 
        NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; 
        NSLog(@"%@",postLength);
        NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init]autorelease]; 
        [request setURL:[NSURL URLWithString:@"http://192.168.0.68:91/JMAPI?RequestType=User&Command=NEW"]]; 
        [request setHTTPMethod:@"POST"]; 
        [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; 
        [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; 
        [request setHTTPBody:postData];

        NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];

        if (theConnection) {
            webData = [[NSMutableData data] retain];
            NSLog(@"%@",webData);

        }

    }
/// this for checking is that Sync is work or not 

-(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]; 
    NSLog(@"Connection failed! Error - %@ %@",
          [error localizedDescription],
          [[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]);
***//ABove line i am getting error that Connection failed! Error - The request timed out.
    http://192.168.0.68:91/JMAPI?RequestType=User&Command=NEW*** 

} 

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


And i am getting this data from sqlitedatabase and from here i am calling the -(void)sendRequest Which is containing   posting method . For code like this 

    -(void)information
    {
        NSString *filePath = [self getWritableDBPath];

        sqlite3 *database;
        if(sqlite3_open([filePath UTF8String], &database) == SQLITE_OK)
        {
            NSString *qu = @"Select  JourneyID,JourneyName,Locationname,StartDate,Distance,ShareType FROM UserJourney where SyncStatus ='1'";
            sqlite3_stmt *compiledStatement;
            if(sqlite3_prepare_v2(database, [qu UTF8String], -1, &compiledStatement, NULL) == SQLITE_OK) 
            {



                while(sqlite3_step(compiledStatement) == SQLITE_ROW ) 
                {

                    char *firstColumn = (char *)sqlite3_column_text(compiledStatement, 0);
                    Journey_ID= [[NSString alloc]initWithUTF8String:firstColumn];
                    NSLog(@"%@",Journey_ID);
                    char * scondColumn = (char *)sqlite3_column_text(compiledStatement, 1);
                    Journey_Name = [[NSString alloc]initWithUTF8String:scondColumn];
                    NSLog(@"%@",Journey_Name);
                    char *thridColumn = (char *)sqlite3_column_text(compiledStatement, 2);
                    Location_Name =[[NSString alloc]initWithUTF8String:thridColumn];
                    NSLog(@"%@",Location_Name);
                    char *fuothColumn = (char *)sqlite3_column_text(compiledStatement, 3);
                    Start_Date = [[NSString alloc]initWithUTF8String:fuothColumn];
                    NSLog(@"%@",Start_Date);
                    Dist = [NSNumber numberWithFloat:(float)sqlite3_column_double(compiledStatement, 4)];
                    NSLog(@"%f",Dist);
                    Share_type = [NSNumber numberWithInt:(int)sqlite3_column_int(compiledStatement, 5)];
                    NSLog(@"%f",Share_type);
                    NSLog(@"%@,%@,%@,%@,%@",Journey_ID,Journey_Name,Location_Name,Start_Date,Dist,Share_type);

    [self sendRequest];***// this is place from where I call the posting method(sendRequest)***

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

I hope get help soon
Thank you

  • 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-25T10:58:20+00:00Added an answer on May 25, 2026 at 10:58 am

    There’s two questions here.

    (1) Timeout – looks like you’re not connecting with whatever is at 192.168.9.68:91 – @Mahesh’s comment is right; check it in Safari in the simulators browser to check that you can connect to that machine.

    (2) This is the more serious one.

    You are calling [self sendRequest] for each row in your sqlite result set. However, all your requets are sharing the same webData object 🙁

    You need to make a seperate class that contains sendRequest and webData and make an instance of it for each request you want to send.

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

Sidebar

Related Questions

I'm trying to port an iPhone application from using SQLite to Core Data. Is
Trying to get my css / C# functions to look like this: body {
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
im developing an Android application for twitter that will sync data coming from the
I'm trying to retrieve data from a POST method, code as follows: -(void)postXMLFeed:(NSString *)XMLStrPost
I am trying to Sync a bunch of Videos I've retrieved from a particular
Using Python (3.1 or 2.6), I'm trying to read data from binary data files
I am trying to extract the mp3 header from a file. This is different
I have a test server that uses data from a test database. When I'm
I'm trying to copy a used repository by using svnsync (I'm doing it this

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.