問題描述
如果用戶設備未註冊 Airwatch Agent,如何限制 iOS 應用程序? (How to restrict iOS App if user device is not enroll with Airwatch Agent?)
在android中,我們可以很容易地檢查設備是否註冊如下:
final boolean isEnrolled = awSDKManager.isEnrolled();
if (isEnrolled) {
final String settings = awSDKManager.getCustomSettings();
}
iOS平台也有類似的功能,通過它我們可以檢查用戶設備是否安裝或註冊了AIRWatch代理應用程序.
請指導我。
參考解法
方法 1:
Firstly initialize AWController for the AIRWatch integration in
‑ (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
AWController *controller = [AWController clientInstance];
// 2) Defining the callback scheme so the app can get called back ‑‑
// this should match the URL scheme you defined in "Callback Scheme Registration".
controller.callbackScheme = @"awsdkcallback";
controller.delegate = self;
[controller start];
return YES;
}
then use the following delegate method to check your device is enrolled or not
‑ (void) initialCheckDoneWithError: (NSError *) error {
if (error) {
NSLog(@"Error in initialization: %@", [error localizedDescription]);
NSLog(@"Not enrolled on AirWatch agent");
} else {
NSLog(@"Initialization completed without error");
}
}
Update: for Latest AirWatch SDK 18, Use the following method for the same:
[controller queryDeviceEnrollmentStatus:^(BOOL isSucess, NSError *error) {
NSLog(@"Error is : %@",error.localizedDescription);
}];
(by Aashish1aug、Aashish1aug)