iOS版本更新判斷

2021-08-28 23:37:25 字數 1544 閱讀 4505

//

// iosgeneral

//// created by xx on 2018/4/23.

//typedef enum : nsuinteger updateflag;

- (void)versionupdate:(updateflag)flag;

@end

//

// iosgeneral

//// created by xx on 2018/4/23.

//#import "lwauodateviewcontroller.h"

@end

- (void)versionupdate:(updateflag)flag else

} else

}];[task resume];

}- (void)receivedata:(id)sender

for (int i = 0; i < count; i++)

//審核時本地大於線上,開發時也有可能

if ([localarray[i] intvalue] > [versionarray[i] intvalue])

}//出現了1.2和1.2.3的情況,肯定是長的那個是高版本,因為不存在1.2和1.2.0對比的情況

if (versionarray.count < localarray.count)

nslog(@"目前沒有新版本");

if ([sender[@"updateflag"] integervalue] == updatenow)

}- (void)alertupdateversion:(nsdictionary *)dic];

}else if ([dic[@"updateflag"] integervalue] == updateoptional) rightaction:^];

} else if ([dic[@"updateflag"] integervalue] == updatenow)

// nsstring *msg = [nsstring stringwithformat:@"更新最新版本"];

// uialertcontroller *alertcontroller = [uialertcontroller alertcontrollerwithtitle:@"公升級提示" message:msg preferredstyle:uialertcontrollerstylealert];

// uialertaction *otheraction = [uialertaction actionwithtitle:@"現在公升級"style:uialertactionstyledestructive handler:^(uialertaction*action)

//

// }];

// [alertcontroller addaction:otheraction];

//

}- (void)gotoupdate

}@end

IOS學習之如何判斷版本更新

在我們使用應用時,一開啟應用,如果此應用有新的版本,常常能在應用中給出提示,是否要更新此應用。所以,我們就來看看,版本更新是如何實現的。蘋果給了我們乙個介面,能根據應用id請求一些關於應用的資訊。我們可以根據返回的資訊,來判斷版本是否和應用的版本一致,如果不一致,那麼就出現新的版本了。這時,就需要向...

iOS 版本更新

通常的做法是在自己的伺服器上記錄最新版本號,從ios客戶端請求,與本地版本號比較,不同則提示更新。這種做法簡單,缺點是需要單獨的伺服器支援。html view plain copy nsstring version nsurl urlid your versionrequest asiformdat...

ios版本更新

在我們使用應用時,一開啟應用,如果此應用有新的版本,常常能在應用中給出提示,是否要更新此應用。所以,我們就來看看,版本更新是如何實現的。蘋果給了我們乙個介面,能根據應用id請求一些關於應用的資訊。我們可以根據返回的資訊,來判斷版本是否和應用的版本一致,如果不一致,那麼就出現新的版本了。這時,就需要向...