ARManager Class Reference
Inherits from | NSObject |
Conforms to | CLLocationManagerDelegate |
Declared in | ARManager.h ARManager.m |
Tasks
-
– deviceLocation
The current location of the device.
-
– deviceHeading
The current heading of the device.
-
– urlForRequest:withPathArgs:
Generates an URL for connecting to the AR API with the given properties.
-
– createRequest:withMethod:withArguments:
Generates a new ASIHTTPRequest object for connecting to the AR API with the provided properties. Connections to the AR system should always be created with this function, which adds authentication headers, metadata, and more to the request.
-
– augmentPhotoUsingNearbySites:completion:
Convenience function that takes the provided photo and creates a new ARAugmentedPhoto object. It automatically begins the augmentation process. To be notified when augmentation results have been received, listen for a NOTIF_AUGMENTED_PHOTO_UPDATED notification with the ARAugmentedPhoto object as the notification object.
-
– addSite:withCompletionBlock:
Adds a site to your account on the server with the given identifier.
-
– removeSite:withCompletionBlock:
Removes a site to your account on the server with the given identifier.
-
– findNearbySites:withCompletionBlock:
Finds nearby sites using a given resolution.
-
– criticalRequestFailed:
A global convenience function for displaying error messages when improtant requests fail. Based on the status code of the response, this function displays different UIAlertViews and notifies the user of the connection issue.
Instance Methods
addSite:withCompletionBlock:
Adds a site to your account on the server with the given identifier.
- (void)addSite:(NSString *)identifier withCompletionBlock:(void ( ^ ) ( void ))completionBlock
Parameters
- identifier
The identifier of the site you’d like to create.
- completionBlock
A block to call when the server response has been received.
Discussion
Adds a site to your account on the server with the given identifier.
Declared In
ARManager.h
augmentPhotoUsingNearbySites:completion:
Convenience function that takes the provided photo and creates a new ARAugmentedPhoto object. It automatically begins the augmentation process. To be notified when augmentation results have been received, listen for a NOTIF_AUGMENTED_PHOTO_UPDATED notification with the ARAugmentedPhoto object as the notification object.
- (ARAugmentedPhoto *)augmentPhotoUsingNearbySites:(UIImage *)image completion:(ARProcessingCompletionBlock)completion
Parameters
- image
The image to be augmented. Must be > 2000 x 2000px to work well.
- completion
A block method that will be executed when augmentation of the image has completed. The block has one parameter which is the augmented photo. The photo has properties related to its status at completion.
Return Value
An ARAugmentedPhoto object that represents the augmented photo. This object provides access to augmentation status and the overlays found within the image.
Discussion
Convenience function that takes the provided photo and creates a new ARAugmentedPhoto object. It automatically begins the augmentation process. To be notified when augmentation results have been received, listen for a NOTIF_AUGMENTED_PHOTO_UPDATED notification with the ARAugmentedPhoto object as the notification object.
@note If your application does not use location services, or if you want to augment an image using a specific ARSite of base images, use the functions in the ARSite to augment photos instead.
You must call setLocationEnabled: YES before calling this method.
Declared In
ARManager.h
createRequest:withMethod:withArguments:
Generates a new ASIHTTPRequest object for connecting to the AR API with the provided properties. Connections to the AR system should always be created with this function, which adds authentication headers, metadata, and more to the request.
- (ASIHTTPRequest *)createRequest:(NSString *)path withMethod:(NSString *)method withArguments:(NSDictionary *)args
Parameters
- path
The absolute path you are requesting, such as @“/ar/site”
- method
The request method, such as @“POST” or @“DELETE”
- args
A set of arguments. If you are making a GET request, these arguments are passed as url parameters. For other requests, they are added to the POST body.
Return Value
A new ASIHTTPRequest or ASIFormDataRequest object. You should attach callbacks and/or a delegate to this request and then call startAsynchronous to start it.
Discussion
Generates a new ASIHTTPRequest object for connecting to the AR API with the provided properties. Connections to the AR system should always be created with this function, which adds authentication headers, metadata, and more to the request.
Declared In
ARManager.h
criticalRequestFailed:
A global convenience function for displaying error messages when improtant requests fail. Based on the status code of the response, this function displays different UIAlertViews and notifies the user of the connection issue.
- (void)criticalRequestFailed:(ASIHTTPRequest *)req
Parameters
- req
The failed request.
Discussion
A global convenience function for displaying error messages when improtant requests fail. Based on the status code of the response, this function displays different UIAlertViews and notifies the user of the connection issue.
Declared In
ARManager.h
deviceHeading
The current heading of the device.
- (CLHeading *)deviceHeading
Return Value
The current heading of the device.
Declared In
ARManager.h
deviceLocation
The current location of the device.
- (CLLocation *)deviceLocation
Return Value
The current location of the device.
Declared In
ARManager.h
findNearbySites:withCompletionBlock:
Finds nearby sites using a given resolution.
- (void)findNearbySites:(int)resolution withCompletionBlock:(void ( ^ ) ( NSArray *))completionBlock
Parameters
- resolution
We use a geohashing algorithm that produces a single hash string from a lat/lon pair. The geohash algorithm subdivides the world into bounding boxes of a predefined resolution (e.g. size). The higher the resolution, the smaller the bounding box and the longer its geohash. If a geohash is a prefix of another one, it means that its bounding box contains the other geohash. The resolution parameter is basically a specification of how large a bounding box you want to search within.
- completionBlock
A block to call when the server response has been received. The NSArray parameter contains the sites.
Discussion
Finds nearby sites using a given resolution.
Declared In
ARManager.h
removeSite:withCompletionBlock:
Removes a site to your account on the server with the given identifier.
- (void)removeSite:(NSString *)identifier withCompletionBlock:(void ( ^ ) ( void ))completionBlock
Parameters
- identifier
The identifier of the site you’d like to remove.
- completionBlock
A block to call when the server response has been received.
Discussion
Removes a site to your account on the server with the given identifier.
Declared In
ARManager.h
urlForRequest:withPathArgs:
Generates an URL for connecting to the AR API with the given properties.
- (NSURL *)urlForRequest:(NSString *)basePath withPathArgs:(NSDictionary *)args
Parameters
- basePath
The absolute path of the request on the server, such as @“/ar/site”
- args
A dictionary of arguments that will be added to the url as GET params
Discussion
Generates an URL for connecting to the AR API with the given properties.
Declared In
ARManager.h