Created
January 21, 2019 20:41
-
-
Save vijaysharm/a220a3474622176b06a88f65fbb4d34f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This example shows how to use getDistributionStatus method in the TestFairy SDK. | |
getDistributionStatus queries the server about the app version currently running on device, and checks | |
to see if "Distribution" is set to "Enabled" in Build Settings page. | |
The example below will close the app if the distribution was disabled. If there is a newer version of | |
this app uploaded to TestFairy, and it is set to "Distribution" => "Enabled", then the code will open a url to | |
the new version, offloading to the operating system to install the app. | |
*/ | |
[TestFairy getDistributionStatus:appToken callback:^(NSDictionary<NSString *,NSString *> *response, NSError *error) { | |
if (error != nil) { | |
if ([@"enabled" isEqualToString:[response objectForKey:@"status"]]) { | |
NSString *urlString = [response objectForKey:@"autoUpdateDownloadUrl"]; | |
NSURL *url = [NSURL URLWithString:urlString]; | |
if (url != nil) { | |
[[UIApplication sharedApplication] openURL:url]; | |
} | |
} | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment