WTAuthorizationRequestManager Class Reference

Inherits from NSObject
Declared in WTAuthorizationRequestManager.h

Overview

WTAuthorizationRequestManager class

Some Apple APIs need authorization from the end user in order to be used. This class can be used to request those required authorizations for restricted Apple APIs.

Restricted Apple APIs are: * Camera access * Location access (GPS access) * Camera Roll album access

Without access to those APIs, the Wikitude SDK might not be able to work properly.

This class category can be used to generate pretty error logs or user interface dialogs from the NSError object given in -requestRestrictedAppleiOSSDKAPIAuthorization:completion completion handler.

Other Methods

  isRequestingRestrictedAppleiOSSDKAPIAuthorization

YES if there is an authorization process currently running, NO otherwise.

@property (nonatomic, assign) BOOL isRequestingRestrictedAppleiOSSDKAPIAuthorization

Declared In

WTAuthorizationRequestManager.h

+ restrictedAppleiOSSDKAPIAuthorizationsForRequiredFeatures:

Use this method to convert WTFeatures into a NSOrderedSet of WTRestrictedAppleiOSSDKAPI (NSNumber is used as enums can’t be used with Foundation container classes). Depending on the features passed, all relevant WTRestrictedAppleiOSSDKAPIs are determined and returned in an ordered set.

+ (NSOrderedSet<NSNumber*> *)restrictedAppleiOSSDKAPIAuthorizationsForRequiredFeatures:(WTFeatures)requiredFeatures

Parameters

requiredFeatures

A combination of WTFeatures that are intended to be used.

Return Value

NSOrderedSet a ordered set of WTRestrictedAppleiOSSDKAPIs based on the features passed as requiredFeatures

Discussion

It is possible to change the order of elements in the returned set in order to customize the sequence of which authorization dialogs are shown.

Declared In

WTAuthorizationRequestManager.h

– requestRestrictedAppleiOSSDKAPIAuthorization:completion:

By calling this method, all WTRestrictedAppleiOSSDKAPIs that are passed in the set are requested. The order of the elements in the set determine the sequence in which individual authorization dialogs are shown.

- (void)requestRestrictedAppleiOSSDKAPIAuthorization:(NSOrderedSet<NSNumber*> *)requiredAppleiOSSDKAPIAuthorizations completion:(void ( ^ ) ( BOOL success , NSError *error ))completionHandler

Parameters

requiredAppleiOSSDKAPIAuthorizations

The restricted Apple APIs for which authorization is asked for.

completionHandler

The block that is called once all authorization states are determined. This block is guaranteed to be called exactly once.

Declared In

WTAuthorizationRequestManager.h

ErrorMessageFormatting Methods

+ humanReadableDescriptionForUnauthorizedAppleiOSSDKAPI:

Converts the keys from the kWTUnauthorizedAppleiOSSDKAPIsKey dictionary into human readable string representations.

+ (NSString *)humanReadableDescriptionForUnauthorizedAppleiOSSDKAPI:(NSString *)unauthorizedAppleiOSSDKAPI

Parameters

unauthorizedAppleiOSSDKAPI

One of the string keys of the kWTUnauthorizedAppleiOSSDKAPIsKey dictionary.

Return Value

String * A human readable string representation for one of the WTRestrictedAppleiOSSDKAPI constants.

Declared In

WTAuthorizationRequestManager.h

+ stringFromAuthorizationStatus:forUnauthorizedAppleiOSSDKAPI:

Converts a given value from the kWTUnauthorizedAppleiOSSDKAPIsKey dictionary into human readable string representations.

+ (NSString *)stringFromAuthorizationStatus:(NSInteger)authorizationStatus forUnauthorizedAppleiOSSDKAPI:(NSString *)unauthorizedAppleiOSSDKAPI

Parameters

authorizationStatus

One of the NSInteger values of the kWTUnauthorizedAppleiOSSDKAPIsKey dictionary.

unauthorizedAppleiOSSDKAPI

One of the string keys of the kWTUnauthorizedAppleiOSSDKAPIsKey dictionary.

Return Value

String * A human readable string representation for one of the authorization status enums that represent a restricted API.

Discussion

This method is just a convenience method that calls either - stringFromAVFoundationAuthenticationStatus - stringFromCoreLocationAuthenticationStatus or - stringFromPhotosAuthenticationStatus based on the given unauthorizedAppleiOSSDKAPI parameter.

Declared In

WTAuthorizationRequestManager.h

+ stringFromAVFoundationAuthenticationStatus:

Converts the given AVAuthorizationStatus constant into a string.

+ (NSString *)stringFromAVFoundationAuthenticationStatus:(AVAuthorizationStatus)authorizationStatus

Parameters

authorizationStatus

one of the AVAuthorizationStatus enum constants.

Return Value

NSString * A string representation of the given AVAuthorizationStatus constant.

Declared In

WTAuthorizationRequestManager.h

+ stringFromCoreLocationAuthenticationStatus:

Converts the given CLAuthorizationStatus constant into a string.

+ (NSString *)stringFromCoreLocationAuthenticationStatus:(CLAuthorizationStatus)authorizationStatus

Parameters

authorizationStatus

one of the CLAuthorizationStatus enum constants.

Return Value

NSString * A string representation of the given CLAuthorizationStatus constant.

Declared In

WTAuthorizationRequestManager.h

+ stringFromPhotosAuthenticationStatus:

Converts the given PHAuthorizationStatus constant into a string.

+ (NSString *)stringFromPhotosAuthenticationStatus:(PHAuthorizationStatus)authorizationStatus

Parameters

authorizationStatus

one of the PHAuthorizationStatus enum constants.

Return Value

NSString * A string representation of the given PHAuthorizationStatus constant.

Declared In

WTAuthorizationRequestManager.h