objective c - iphone mapkit application performing local business searches -


Developing an iPhone application using the MacKit framework I've got integrated map view in the application. Using some APIs, there was some help about searching in the field (local search), I tried to search for the Google Java Script API and AJAX API, but could not point to my solution, anyone Also help would be appreciated. Below is a partial bit code that I used for the Google Search API.

You need to go to the Google Labs API to get a key that you can use to search. There is also a GDATA library, but I was having trouble working on local search because I went with the HTML / JSN version. My code shows you how to decode the return JSON, I cut the loop because it is a bunch of other stuff.

This is a link.

I recommend making an API call and then setting up a breakpoint where you can see the dictionary of JSON results, so you can see how it is structured.

  NSString * searchString = [NSString stringWithFormat: @ "Http://ajax.googleapis.com/ajax/services/search/local?v=1.0&sll=%f,%f& ; Q =% @ ", the current location.static locale Coordination.Limitry, Current Location. Established Location. Coordination Long, search system]; SearchString = [Search String StringEdderPaper escaping encoding: NSUFF 8 string encoding]; // encode it // NSString * localSearchResults = [NSString stringWithContentsOfURL: [NSURL URLWithString: searchString]]; NSError * Error = Zero; NSString * localSearchResults = [NSString stringWithContentsOfURL: [NSURL URLWithString: searchString] Encoding: NSUTF8StringEncoding Error: & amp; Error]; Error in retrieving map search results in if (error! = Nil) {NSLog (@ "SearchLocationViewControler :: lookupSearchTerms";); NSLog (@ "% s% d% s", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__); // http://stackoverflow.com/questions/969130/nslog-tips-and-tricks/969272 NSLog (@ "Unsoltered Error% @,% @", Error, [Error User Information]); } Other {NSDTata * JSNDTU = [Local Search Search Results Data Encryption: NSUFF 32 BG Endian String Encoding]; NSError * Error = Zero; NSDictionary * dictionary = [[[CJS androidileriserialiser] DecierialsAscrption: JSD data error: & amp; Error]; // We now magically have an array of results from our search. Each result contains a bunch of data. NSArray * resultsArray = [[objectForKey: @ "responseData"] objectForKey: @ "results"]; // NSArray * resultsArray = [Dictionary objectForKey: @ "responseData"]; CLLocationCoordinate2D Corordinate; NSDictionary * current result; BOOL skip thisEntry; (Int i = 0; i & lt; [result count]; i ++) {currentResult = [resultsArray objectItindex: i]; // This is a dictionary of the result curCoordinate.latitude = [(NSString *) [currentResult objectForKey: @ "Late"] Double Values]; CurCoordinate.longitude = [[NSString *] [Current Result Object Foreaki: @ "LNG"] Double Values];  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -