I have an app which is connected to a database via php, Im trying to send some large data to the database e.g. a list of coordinates
"37.351701,-122.105898",
"37.351945,-122.106109",
"37.352183,-122.106338",
"37.352409,-122.106568"
a string like this of 4 lines gets added no problem, a string of 150 lines also gets added but around the 200 lines mark its not, and the rest of the data Im trying to post with it also gets lost. I have tested this with php by creating .txt and adding the data to it and its not reaching the the php file if its over 200 lines, but 150 is fine again.
Im taking the coordinates and putting them into an array,
if ((oldLocation.coordinate.latitude != newLocation.coordinate.latitude) &&
(oldLocation.coordinate.longitude != newLocation.coordinate.longitude))
self.trackCoord = [NSString stringWithFormat:@"%f,%f",newLocation.coordinate.latitude, newLocation.coordinate.longitude];
if (!self.trackArray) {
self.trackArray = [[NSMutableArray alloc] init];
}
[self.trackArray addObject:self.trackCoord];
the array get passed into another array trackArrayList
etc and in this method im posting to the php file.
-(void) shareRoute:(NSString*) to withName:(NSString *) from withName:(NSString *) name withName:(NSString *) type withName:(NSString *) duration withName:(NSMutableArray *) trackArrayList{
if (from != nil && to != nil && name != nil){
NSMutableString *postString = [NSMutableString stringWithString:shareURL];
[postString appendString:[NSString stringWithFormat:@"?%@=%@", Sfrom, from]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", Sto, to]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", Sname, name]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", Stype, type]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", Sduration, duration]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", StrackArray, trackArrayList]];
[postString setString:[postString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:postString]];
[request setHTTPMethod:@"POST"];
postConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
}
}
I have tried writing [postString appendString:[NSString stringWithFormat:@"&%@=%@", StrackArray, trackArrayList]];
in different variations, NSMutableString stringWithFormat
etc but same result.
Is the string not big enough to hold so many lines or is the app running out of memory before being able to post.
Any suggestions to what could be causing this, or any others ways to write the appendString
.