Print policy API details
The AppConnect for iOS API provides properties and methods that allow an app to handle its print policy as determined by the MobileIron server. For an overview of this feature, see Data loss prevention policies.
The ACPrintPolicy enumeration
The ACPrintPolicy enumeration provides the possible print statuses for the app:
typedef enum { ACPRINTPOLICY_UNAUTHORIZED = 0, // The application may not use Print. ACPRINTPOLICY_AUTHORIZED = 1, // The application may use Print. } ACPrintPolicy;
The printPolicy property
The read-only printPolicy property on the AppConnect singleton contains an ACPrintPolicy value. The value reflects the current status of the print policy for the app.
When your app launches:
• | Get the singleton AppConnect object and call its -startWithLaunchOptions: method. |
• | Wait for the -appConnectIsReady: callback method before accessing the printPolicy property. |
• | After the -appConnectIsReady: callback method is called, enable or disable the app’s ability to print depending on the printPolicy property value. |
Whenever the policy changes, the AppConnect library:
1. | updates the printPolicy property. |
2. | calls the -appConnect:printPolicyChangedTo: method to provide your app the current print policy. |
Print policy methods
Your app uses the following methods to receive print policy updates and to report how the app handled the updates.
The -appConnect:printPolicyChangedTo: callback method
You optionally implement this method, which is in the AppConnectDelegate protocol:
-(void) appConnect:(AppConnect *)appConnect printPolicyChangedTo: (ACPrintPolicy)newPrintPolicy;
Implement this method only if your app is able to print.
When a change has occurred to the print policy on the MobileIron server, the AppConnect library:
1. | Sets the printPolicy property on the AppConnect object to the new ACPrintPolicy value. |
2. | Calls the -appConnect:printPolicyChangedTo: method, which provides the new ACPrintPolicy value in its parameter. |
Your app then:
• | Enables or disables its ability to print depending on the passed ACPrintPolicy value. |
• | calls the -printPolicyApplied:message: method. |
The -printPolicyApplied:message: acknowledgment method
After your app processes the information provided in the callback method, it must call this acknowledgment method on the AppConnect singleton:
-(void) appConnect:(AppConnect *)appConnect printPolicyChangedTo: (ACPrintPolicy)newPrintPolicy;
Your app passes the following parameters to this method:
• | the ACPolicyState value that represents the success or failure of handling the print policy update. |
Pass the value ACPOLICY_APPLIED if the app successfully handled the update. Otherwise, pass the value ACPOLICY_ERROR. Pass the value ACPOLICY_UNSUPPORTED if your app does not support print. If you do not implement the -printPolicyApplied:message method, the AppConnect singleton behaves as if you passed it ACPOLICY_UNSUPPORTED.
• | an NSString explaining the ACPolicyState value. |
Typically, you use this string to report the reason the app failed to apply the print policy update. The string is reported in the MobileIron server log files.