2014-10-29 55 views
0

我一直在這個問題上堅持了幾周,所以我非常感謝一些幫助。我試圖發送一個http Post與ios應用程序,即時通訊開發,但推動永遠不會到達服務器,雖然我得到一個代碼200作爲響應(從urlconnection)。johnpet的webservice調用

回答

0
-(void)webservice_Call 

{ 

    NSString *[email protected]"http://api.openweathermap.org/data/2.1/find/city?lat=10.369&lon=122.5896"; 

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString] 
                 cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData 
                timeoutInterval:10]; 

    [request setHTTPMethod: @"GET"]; 

    NSError *requestError; 

    NSURLResponse *urlResponse = nil; 


    NSData *response1 = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&requestError]; 

    NSDictionary *resDictionary = [NSJSONSerialization JSONObjectWithData:response1 options:NSJSONReadingMutableContainers error:Nil]; 

} 
+0

現在你的問題得到解決或你需要幫助兄弟 – 2014-10-29 12:35:49

+0

解決了,謝謝 – 2014-10-29 12:47:27