AppConnect ready API details

The ready property

The AppConnect for iOS API provides a read-only property on the AppConnect singleton called ready:


@property (nonatomic, readonly, getter=isReady) BOOL ready;

This property and its getter method isReady indicate whether the AppConnect singleton is ready for the app to access the singleton’s instance properties. The app can access the instance properties only if isReady is YES. If isReady is NO, an attempt to access an instance property throws an exception. The thrown NSException object has the name "ACPropertyAccessException".

When the app calls the AppConnect singleton’s method -startWithLaunchOptions:, the value of ready is NO. When the AppConnect library calls the callback method
-appConnectIsReady:, the value changes to YES. The value remains YES for the life of the app.

Impacted instance properties

When isReady is NO, accessing the following instance properties throw an exception:


@property (nonatomic, readonly) ACManagedPolicy managedPolicy;


@property (nonatomic, readonly) ACAuthState authState;


@property (unsafe_unretained, nonatomic, readonly) NSString *authMessage;


@property (nonatomic, readonly) ACPasteboardPolicy pasteboardPolicy;


@property (nonatomic, readonly) ACOpenInPolicy openInPolicy;


@property (unsafe_unretained, nonatomic, readonly) NSSet *openInWhitelist;


@property (nonatomic, readonly) ACPrintPolicy printPolicy;


@property (nonatomic, readonly) ACSecureFileIOPolicy secureFileIOPolicy;


@property (unsafe_unretained, nonatomic, readonly) NSDictionary *config;

You can access the instance property secureServicesAvailability at any time.

The -appConnectIsReady: callback method

You are required to implement this method, which is in the AppConnectDelegate protocol:

-(void)appConnectIsReady:(AppConnect *)appConnect;

The AppConnect library calls this method when the value of the ready property has changed. The AppConnect library calls this method one time after the app calls the AppConnect singleton’s method -startWithLaunchOptions:. The value of ready is changed to YES, which means that the instance properties on the AppConnect singleton are initialized and ready for the app to access.

In the -appConnectIsReady: method:

Access the instance properties on the AppConnect singleton.

Update the app with the current authorization status, data loss prevention policies, secure file I/O policy, and configuration key-value pairs.

Remove the user interface indication that informed the user that the app was initializing.

Always update the app’s policies and configuration status in the -appConnectIsReady: method, which the AppConnect library calls every time the app is launched. The AppConnect library calls other callback methods, such as the callback methods for authorization, data loss prevention policies, and configuration, only if the status has changed. Therefore, you can always expect all these callback methods on the first launch of the app. However, subsequent launches often result in the AppConnect library calling only the -appConnectIsReady: method.

Pseudocode for -isAppConnectReady:

The following pseudocode illustrates how to use the isReady getter and the
-isAppConnectReady: callback method. In this example:

The same class implements the UIApplicationDelegate protocol and the AppConnectDelegate protocol.

The class has an instance property called appConnect for saving the AppConnect singleton.

- (void)applicationDidBecomeActive:(UIApplication *)application
        if ([self.appConnect isReady]) {
            [self updateWithAppConnectPolicies];
        else {
            [self presentAppInitializingWithMessage:NSLocalizedString 
                                        (@"Authorizing. Please wait...", nil)];
-(void)appConnectIsReady:(AppConnect *)appConnect {
    [self updateWithAppConnectPolicies];
    [self dismissAppInitializing];
-(void)updateAppConnectPolicies {
   // Check isReady since this method can be called from methods besides
   // -appConnectIsReady:
   if ( [appConnect isReady]) {
       // Check the app’s authorization, policies, and configuration status
       // and update the app appropriately.