All Products
Document Center

Version update code sample

Last Updated: Feb 04, 2021

Android code sample

To check the style and interaction effect of this function in mobile device, download Android code sample, then compile bundle in local Android Studio and install .apk file in you mobile device. See Get code sample for more information.

iOS code sample

Check for updates

mPaaS automatically connect the release function by calling update check interface to check whether a new version is available. If a new version is available, a update window automatically pop up to remind user for update. User tap Update to start auto update, no other encoding is required. To custom update prompt window, see UI of custom update prompt below.

  1. - (void)checkUpdate
  2. {
  3. UpgradeCheckService *service = [UpgradeCheckService sharedService];
  4. service.delegate = self;
  5. [service checkUpgradeAndShowAlertWith:YES];
  6. }

Note: When you add SDK, the dependency on release service gateway mPaaS > Targets > MPHttpClient > DTRpcInterface+upgradeComp.m is automatically added, thus you only need to call checkUpgradeAndShowAlertWith method, the release component automatically connect the release service in background.

UI of custom update prompt

You can custom the update prompt by implementing delegate.

  1. # pragma mark UpgradeViewDelegate
  2. - (UIImage *)upgradeViewHeader
  3. {
  4. return [UIImage imageNamed:@"FinancialCloud"];
  5. }
  6. - (void)showProgressHUD:(BOOL)animation
  7. {
  8. self.toast = [APToastView presentToastWithin:self.view withIcon:APToastIconLoading text:nil];
  9. }
  10. - (void)hideProgressHUD:(BOOL)animation
  11. {
  12. [self.toast dismissToast];
  13. }
  14. - (void)showToastViewWith:(NSString *)message duration:(NSTimeInterval)timeInterval
  15. {
  16. [self showAlert:message];
  17. }