2012-03-01 266 views
-1

我想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) 

我錯了什麼?

+1

也許你使用'stringwithFormat'而不是'stringWithFormat' – Bonny 2012-03-01 09:23:08

回答

1

請嘗試使用更多的CodeSense功能。

stringWithFormat:stringwithFormat:

希望這有助於你。

+0

雅但我在哪裏寫? &錯誤是我粘貼從我的Xcode。 – Siten 2012-03-01 09:37:34

+0

只需在您的項目中搜索字符串stringwithFormat並將其替換爲stringWithFormat – 2012-03-01 09:40:07