zoukankan      html  css  js  c++  java
  • iOSApp版本更新

    iOS版本更新:调接口

    后台返回三种状态  1.强制更新  2.无需更新 3.用户选择是否更新

    - (void)requestToCheckVersion

    {

        ELifeNetRequestData *req = [[ELifeNetRequestData alloc] init];

        [req setString:MFAppVersionShort forKey:@"versionNo"];

        [req setString:@"iphone" forKey:@"osName"];

        

        [[ELifeNetAPIClient sharedClient] requestPostWithType:ELifeRequest_getVersion args: [req toDictionary]

        success:^(id responseObject) {

            int forceUpgrade = [[responseObject objectForKey:@"forceUpgrade"] intValue];

            self.updateUrl = [responseObject objectForKey:@"upgradeUrl"];

            

            if (forceUpgrade == 1) {

                //强制更新

                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.updateUrl]];

                return ;

            }else if (forceUpgrade == 2){

                //无需更新

                return;

            }else if (forceUpgrade == 3){

                //用户选择是否更新 alert

                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"有新版本,现在去更新吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];

                alert.tag = 1012;

                [alert show];

            }

            

        } failure:^(NSError *error) {

            

        }];

    }

    1
  • 相关阅读:
    hdu 4002 Find the maximum
    hdu 2837 坑题。
    hdu 3123
    zoj Treasure Hunt IV
    hdu 2053 Switch Game 水题一枚,鉴定完毕
    poj 1430 Binary Stirling Numbers
    hdu 3037 Saving Beans
    hdu 3944 dp?
    南阳oj 求N!的二进制表示最低位的1的位置(从右向左数)。
    fzu 2171 防守阵地 II
  • 原文地址:https://www.cnblogs.com/fantasy3588/p/4707453.html
Copyright © 2011-2022 走看看