I am trying to update the user's location on the backoffice even while the app is in backgound, so I trigger a location update calling the following php script:
-(void)locateUserAtLocation:(CLLocation*)location{
NSDictionary* dict=[self getCurrentAppAndUrlDictionary];
NSString* app=[dict objectForKey:@"app"];
float latitude=location.coordinate.latitude;
float longitude=location.coordinate.longitude;
NSString* language=[[NSLocale currentLocale] localeIdentifier];
NSString* nickName=[[NSUserDefaults standardUserDefaults] objectForKey:@"nickname"];
NSString* myUdid= [udid sharedUdid];
NSString *insertUrlString =[NSString stringWithFormat: @"http://www.miafoto.it/iPhone/inarrivo/taxi/insertUserNew.php?udid=%@&token=%@&nickname=%@&app=%@&language=%@&Latitude=%f&Longitude=%f&new=1",myUdid, token, nickName, app, language, latitude, longitude];
NSLog(@"url=%@", insertUrlString);
NSURLSessionDownloadTask *insertTask = [[self backgroundSession] downloadTaskWithURL: [NSURL URLWithString:insertUrlString]];
[insertTask resume];
}
but I get error: Invalid URL scheme for background downloads: (null). Valid schemes are http or http and no url is sent either in foreground or background. I searched on the web I found no hits addressing this issue. I also submitted the issue to the Apple support.
POST
request (which is designed for when submitting data to be processed by web service). Also, if you shifted to https at some future date, this would keep the udid, token, etc., more secure than aGET
request would. – Carthusian