As promised, I've been developing code tutorials by digging into code and treating it like Legos. Ooh, what happens if I put this here? Attached is a tutorial using the above classes and protocols. The comments and questions I will spurt off are in the code. Please enjoy and participate in the discussion.
Important Note: For simplicity of implementation, everything is output to the console.
For the returnFields passed to the AGSLocator object via the locationsForAddress function, is there a better way to initialize the NSArray of Strings? There seems to be no notion of initializer lists in Objective-C and the NSArray class method arrayWithObjects doesn't appear to work with a parameter list of @"" string literals. Am I missing something here? What am I missing?
Where can I figure out the spatial reference for a GeocodeServer? I poked around the REST endpoint, but couldn't find the answer I wanted. Also, why does AGSPoint not return it's spatial reference through an accessor ("getter", I forgot if there is Apple specific term for this)?
Most importantly, look in the "This doesn't work?" block in the didFindLocationsForAddress method. It appears the NSDictionary address property is returned improperly. The count is null and there are 0 keys and values, respectively. Set a breakpoint on 150 and hover over candidate to inspect the candidate's address property.
I've taken a quick look at the tutorials you put up and wanted to get back to you on one of your questions. Concerning how to initialize a list of strings, you can use the 'arrayWithObjects' class method on NSArray:
>I've taken a quick look at the tutorials you put up and wanted to get back to >you on one of your questions. Concerning how to initialize a list of strings, >you can use the 'arrayWithObjects' class method on NSArray:
>The only tricky thing is to remember that the last element needs to be nil.
>Also, there is an 'arrayWithObject', which takes a single object. Code >completion sometimes picks up that one instead of 'arrayWithObjects'.
I retrieved that and it worked. I think my problem may have been picking up on arrayWithObject instead of arrayWithObjects, but I looked at that code long and hard. I'll try appending all the fields in there and see if I can recreate the problem. Thanks Mark.