我想30秒後,發送經緯度長....對於將數據發送到PHP服務器
我使用,
if (theDiff > 30.0f || myDate == nil){
//do your webservices stuff here
NSLog(@"Location get ===================");
double lat = newLocation.coordinate.latitude;
double longt = newLocation.coordinate.longitude;
NSString *ids = [NSString stringWithFormat:@"%d",[[NSUserDefaults standardUserDefaults]integerForKey:CURRENT_USERID]];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:UPDATE_LATLONG]];
[request setPostValue:[NSNumber numberWithDouble: lat] forKey:@"latitude"];
[request setPostValue:[NSNumber numberWithDouble: longt] forKey:@"longitude"];
[request setPostValue:ids forKey:@"userid"];
[request startSynchronous];
NSString *XMLResponseString = [request responseString];
NSLog(@"XMLResponseString %@",XMLResponseString);
[request release];
NSLog(@"lat = %.6f",lat);
NSLog(@"long = %.6f",longt);
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setObject:lastDate forKey:@"myDateKey"];
[prefs synchronize];
}
但給人錯誤...
2012-03-01 15:01:43.352 BiiMe[1638:207] +[NSString stringwithFormat:]: unrecognized selector sent to class 0x447fd8
sharedlibrary apply-load-rules all
(gdb)
我錯了什麼?
也許你使用'stringwithFormat'而不是'stringWithFormat' – Bonny 2012-03-01 09:23:08