IOS APP如何實現公升級

2021-06-18 18:28:43 字數 981 閱讀 2207

當前執行程式的版本資訊,可以在 mainbundle 裡面獲取:

[cpp]view plain

copy

print?

nsdictionary *infodict = [[nsbundle mainbundle] infodictionary];  

nsstring *currentversion = [infodict objectforkey:@"cfbundleversion"];  

其一:在某個伺服器上儲存最新發布的版本資訊,需要的時候向該伺服器查詢;

具體步驟如下:

1,用 post 方式傳送請求:

[html]view plain

copy

print?

);  

}  

然後從中取得 results 陣列即可,具體**如下所示:

[cpp]view plain

copy

print?

nsdictionary *jsondata = [datapayload jsonvalue];  

nsarray *infoarray = [jsondata objectforkey:@"results"];  

nsdictionary *releaseinfo = [infoarray objectatindex:0];  

nsstring *latestversion = [releaseinfo objectforkey:@"version"];  

nsstring *trackviewurl = [releaseinfo objectforkey:@"trackviewurl"];  

如果你拷貝 trackviewurl 的實際位址,

[cpp]view plain

copy

print?

iOS APP如何實現版本檢測更新

原理 拿到蘋果伺服器我們產品資訊 包含版本號version和buile 還有產品的所有資訊 跟當前安裝的產品的版本進行比較。2 根據上面的位址請求需要的資訊 檢測更新 responseobject是個字典 有兩個key 具體實現為 nsarray arr responseobject objectf...

iOSAPP公升級時檔案的留存問題

公升級要考慮到和前乙個版本已經存在的檔案之間的相容問題,可以先用舊工程跑一遍,再用新的跑一遍,看有無問題。這是血的教訓!切記 在應用程式更新過程中被儲存的檔案 雖然其它使用者目錄下的檔案也可能被轉移,但是您不應該假定更新之後該檔案還仍然存在。常用目錄 目錄,包含應用程式的本身。documents 您...

iOS APP新版本公升級資料庫

typedef ns enum nsinteger,dbversion static nsstring const dbversionnum dbversionnum static nsstring const dbpath tmp tmp.db 資料庫位址 static nsstring cons...