Restrict Test Users by Authentication Information
You can detect who is using your app through DeployGate SDK. For example, you can inform them the latest version is pending to be updated.
In some cases, you may want to restrict app distribution only to users you explicitly allowed.
DeployGate SDK provides several functions to check if the user has a privilege to use your app, in other words, if the current DeployGate user has your app on the list.
Usage
Register Custom URL Scheme
Get Custom URL Scheme from App page in DeployGate.
Open your project in Xcode and setup the Custom URL Scheme at TARGETS > Info > URL Types
.
Turn user authorization on and setup
Please open AppDelegate class which contains UIApplicationDelegate protocol in Xcode and please replace the line added before in Usage section 1. of [How to Install] chapter with the following line. Turn user authorization on will make the app launch mobile safari to get user information when boot.
DeployGateSDK
.sharedInstance()
.launchApplication(withAuthor: "<app owner name>", key: "<target_application_api_key>", userInfomationEnabled: true)
[[DeployGateSDK sharedInstance] launchApplicationWithAuthor:@"<app owner name>" key:@"<target_application_api_key>" userInfomationEnabled:YES];
Please replace the API Key for each application to <target_application_api_key>
. API Key is you can check in the detailed page of each application.
Pass user information to SDK
In order to use the user information got from safari, add the following line to AppDelegate's application:openURL:sourceApplication:annotation:
.
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return DeployGateSDK.sharedInstance().handleOpen(url as URL!, sourceApplication: sourceApplication, annotation: annotation)
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[DeployGateSDK sharedInstance] handleOpenUrl:url sourceApplication:sourceApplication annotation:annotation];
}
Completed to set up!
Now the app will check for update when boot, and userAuthorizationWithCompletionHandler:
will check whether the user has privilege to use your app or not.