ios - iphone google geocoding request failed -


i want use google geo coding find list of place's latitude longitude name, have no experience of using in iphone, in android call url. when try same in iphone give me error "request denied". guide me how integrate in iphone or should use library bsforwardgeocoder, doing

nsstring *url = [nsstring stringwithformat:@"http://maps.googleapis.com/maps/api/geocode/json?address=%@&sensor=true", locationstring]; url = [url stringbyreplacingoccurrencesofstring:@" " withstring:@"%20"];  nsurl *wurl = [nsurl urlwithstring:url]; nsdictionary *dict =  [json objectwithurl:wurl]; nslog(@"%@", dict); 

and prints

{ results =     ( ); status = "request_denied"; } 

check this

nsstring *locationstring = @"1600 amphitheatre parkway, mountain view, ca"; nsstring *url = [nsstring stringwithformat:@"http://maps.googleapis.com/maps/api/geocode/json?address=%@&sensor=true", locationstring]; url = [url stringbyreplacingoccurrencesofstring:@" " withstring:@"%20"];  nsurl *wurl = [nsurl urlwithstring:url]; nsdata *data = [nsdata datawithcontentsofurl: wurl];  // fail data server if (nil == data) {      nslog(@"error: fail data"); } else{     // parse json data     nserror *error;     nsdictionary *json = [nsjsonserialization                           jsonobjectwithdata:data                           options:kniloptions                           error:&error];      // check status of result     nsstring *resultstatus = [json valueforkey:@"status"];      // if responce valid     if ( (nil == error) && [resultstatus isequaltostring:@"ok"] ) {          nslog(@"%@", json);     } } 


reference: the google geocoding api


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -