1. 程式人生 > >iOS應用程式之如何獲取版本號實現應用更新

iOS應用程式之如何獲取版本號實現應用更新

{

resultCount = 1;

results = (

{

artistId = 301724683;

artistName = Citibank;

artistViewUrl = "http://itunes.apple.com/us/artist/citibank/id301724683?uo=4";

artworkUrl100 = "http://a5.mzstatic.com/us/r1000/117/Purple/a1/85/a9/mzl.hvwnfdkw.png";

artworkUrl512 = "http://a5.mzstatic.com/us/r1000/117/Purple/a1/85/a9/mzl.hvwnfdkw.png";

artworkUrl60 = "http://a2.mzstatic.com/us/r1000/099/Purple/67/86/7e/mzi.utfdvrgy.png";

averageUserRating = "3.5";

averageUserRatingForCurrentVersion = 5;

contentAdvisoryRating = "4+";

currency = USD;

description = "Description of you app.";

features = (

iosUniversal

);

fileSizeBytes = 4141195;

genreIds = (

6015

);

genres = (

Finance

);

ipadScreenshotUrls = (

"http://a1.mzstatic.com/us/r1000/095/Purple/e0/a6/17/mzl.pbbxcjzt.1024x1024-65.jpg",

"http://a3.mzstatic.com/us/r1000/036/Purple/cc/14/98/mzl.dyairego.1024x1024-65.jpg"

);

isGameCenterEnabled = 0;

kind = software;

languageCodesISO2A = (

EN

);

price = 0;

primaryGenreId = 6015;

primaryGenreName = Finance;

releaseDate = "2011-01-24T06:14:35Z";

releaseNotes = "* View Real-time streaming prices for U.S. Treasuries \n\n* Open and Save your Citi Research in your favorite PDF Reader and Library such as iBooks\n\n* Search for your favorite videos";

screenshotUrls = (

"http://a3.mzstatic.com/us/r1000/066/Purple/17/51/fb/mzl.zywiavgn.png",

"http://a5.mzstatic.com/us/r1000/026/Purple/73/85/97/mzl.csmdtndk.png"

);

sellerName = "Citibank, N.A.";

sellerUrl = "http://";

supportedDevices = (

all

);

trackCensoredName = "Citi Velocity";

trackContentRating = "4+";

trackId = 414697122;

trackName = "Citi Velocity";

trackViewUrl = "http://itunes.apple.com/us/app/citi-velocity/id414697122?mt=8&uo=4";

userRatingCount = 5;

userRatingCountForCurrentVersion = 1;

version = "1.4";

wrapperType = software;

}

);

}

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

NSDictionary *jsonData = [dataPayload JSONValue];

NSArray *infoArray = [jsonData objectForKey:@"results"];

NSDictionary *releaseInfo = [infoArray objectAtIndex:0];

NSString *latestVersion = [releaseInfo objectForKey:@"version"];

latestVersion即為Appstore上的最新發布版本