Skip to content
aferre edited this page Oct 7, 2011 · 6 revisions

You'll need a Google Maps API key to use this WS. Go to http://code.google.com/intl/fr-FR/apis/maps/documentation/places/#Authentication and follow the procedure. Obviously you won't be able to use the framework out of the box as you'll need to provide this key in afGoogleMapsAPIRequest.h (#define API_KEY).

Searches

afGMapsPlaceSearchesRequest *req = [afGMapsPlaceSearchesRequest request];
req.location = CLLocationCoordinate2DMake(13, 22);
req.name = …;
req.radius = 1000;
req.afDelegate = self;
[req startAsynchronous];

You’ll need to implement the following delegate functions. All are optional:

-(void) afPlaceSearchesWSStarted:(afGMapsPlaceSearchesRequest *)ws ;

-(void) afPlaceSearchesWS:(afGMapsPlaceSearchesRequest *)ws foundPlaces:(NSArray *)placesArray htmlAttributions:(NSArray *)htmlAttributions;

-(void) afPlaceSearchesWSFailed:(afGMapsPlaceSearchesRequest *)ws withError:(NSError *)er;

Details

afGMapsPlaceDetailsRequest *req = [afGMapsPlaceDetailsRequest request];
req.afDelegate = self;
req.reference = …;

[req startAsynchronous];

You’ll need to implement the following delegate functions. All are optional:

-(void) afPlaceDetailsWSStarted:(afGMapsPlaceDetailsRequest *)ws ;

-(void) afPlaceDetailsWS:(afGMapsPlaceDetailsRequest *)ws gotDetails:(PlaceDetails *)details htmlAttributions:(NSArray *)htmlAttributions;

-(void) afPlaceDetailsWSFailed:(afGMapsPlaceDetailsRequest *)ws withError:(NSError *)er;

Checkin

afGMapsPlaceCheckinRequest *req = [afGMapsPlaceCheckinRequest request];
req.afDelegate = self;
req.reference = ...;
[req startAsynchronous];

You'll need to implement the following delegate functions. All are optional:

-(void) afPlaceCheckinWSStarted:(afGMapsPlaceCheckinRequest *)ws ;

-(void) afPlaceCheckinWSSucceeded:(afGMapsPlaceCheckinRequest *)ws;

-(void) afPlaceCheckinWSFailed:(afGMapsPlaceCheckinRequest *)ws withError:(NSError *)er;

Report

//delete request
afGMapsPlaceReportRequest *req = [afGMapsPlaceReportRequest request];
req.afDelegate = self;
[req setTheReference:@"..."];


//add request
afGMapsPlaceReportRequest *req = [afGMapsPlaceReportRequest request];
req.afDelegate = self;
req.location = CLLocationCoordinate2DMake(latitude, longitude);
[req setTheName:@"name"];    
req.accuracy = 20; // 20 meters
req.types = [[NSArray alloc] initWithObject:@"establishment"];

[req startAsynchronous];

You'll need to implement the following delegate functions. All are optional:

-(void) afPlaceReportWSStarted:(afGMapsPlaceReportRequest *)ws ;

For the succesfull completion of a Report request, you can either use the first delegate afPlaceReportWSSucceeded:, or you can you one of the other depending on the request's configuration. Note that if you implement afPlaceReportWS:succesfullyAdded:withId: or afPlaceReportWS:succesfullyDeleted:, they'll be called called but afPlaceReportWSSucceeded: won't be.

-(void) afPlaceReportWSSucceeded:(afGMapsPlaceReportRequest *)ws;

-(void) afPlaceReportWS:(afGMapsPlaceReportRequest *)ws succesfullyAdded:(NSString *)ref withId:(NSString *)theid;

-(void) afPlaceReportWS:(afGMapsPlaceReportRequest *)ws succesfullyDeleted:(NSString *)ref;

For the failed completion of a Report request, you can either use the first delegate afPlaceReportWSFailed:withError:, or you can you one of the other depending on the request's configuration. Note that if you implement afPlaceReportWSFailed:toAdd:withError: or afPlaceReportWSFailed:toDelete:withError:, they'll be called called but afPlaceReportWSFailed:withError: won't be.

-(void) afPlaceReportWSFailed:(afGMapsPlaceReportRequest *)ws withError:(NSError *)er;

-(void) afPlaceReportWSFailed:(afGMapsPlaceReportRequest *)ws toAdd:(NSString *)ref withError:(NSError *)er;

-(void) afPlaceReportWSFailed:(afGMapsPlaceReportRequest *)ws toDelete:(NSString *)ref withError:(NSError *)er;
Clone this wiki locally