好吧跋选,對于蘋果審核來說蛋疼的一逼涕癣,上傳了三次,每次的審核都因為各種原因給打回來前标,最后一次是因為支付虛擬服務需要通過虛擬貨幣購買坠韩,可是收30%的提成,導致了公司不同意這種方法炼列,于是就各種問小伙伴規(guī)避方法只搁,下面的是更新:
NSString*appleID =@"your app appleID";
NSMutableURLRequest*request?=?[[NSMutableURLRequestalloc]?init];
[request?setURL:[NSURLURLWithString:[NSStringstringWithFormat:@"http://itunes.apple.com/lookup?id=%@",appleID]]];
[request?setHTTPMethod:@"GET"];
NSData*returnData?=?[NSURLConnectionsendSynchronousRequest:request?returningResponse:nil?error:nil];
NSMutableDictionary*jsondata?=?[NSJSONSerializationJSONObjectWithData:returnData?options:NSJSONReadingMutableLeaveserror:nil];
NSLog(@"jsondata===%@",jsondata);
NSMutableArray*resultsArr?=?[jsondata?objectForKey:@"results"];
NSMutableDictionary*infodic?=?[resultsArr?objectAtIndex:0];
NSString*latestVersion?=?[infodic?objectForKey:@"version"];
NSString*trackViewUrl?=?[infodic?objectForKey:@"trackViewUrl"];
NSLog(@"%@",trackViewUrl);
NSLog(@"latestVersion=%@",latestVersion);
[[NSUserDefaultsstandardUserDefaults]setObject:trackViewUrl?forKey:@"trackViewUrl"];
NSLog(@"uurrll=%@",trackViewUrl);
NSDictionary*infoDict?=?[[NSBundlemainBundle]?infoDictionary];
NSString*currentVersion?=?[infoDict?objectForKey:@"CFBundleShortVersionString"];
NSLog(@"當前版本號是%@",currentVersion);
NSLog(@"doublecurrent=%@",currentVersion);
if([currentVersion?isEqualToString:latestVersion])?{
NSLog(@"版本相同?不用更新");
[[NSUserDefaultsstandardUserDefaults]?removeObjectForKey:@"updateVersion"];
[[NSUserDefaultsstandardUserDefaults]?setObject:@"no"forKey:@"updateVersion"];
}else
{NSArray*?newVerAry?=?[latestVersion?componentsSeparatedByString:@"."];
NSArray*?curVerAry?=?[currentVersion?componentsSeparatedByString:@"."];
for(inti?=0;?i?<?[newVerAry?count]?||?i?<?[curVerAry?count];?i++)
{
intnewSubVer,?curSubVer;
//?如果子版本號數(shù)不足,作為0處理
if(i?>=?[newVerAry?count])
{
newSubVer?=0;
}
else
{
newSubVer?=?[[newVerAry?objectAtIndex:i]?intValue];
}
if(?i?>=?[curVerAry?count])
{
curSubVer?=0;
}
else
{
curSubVer?=?[[curVerAry?objectAtIndex:i]?intValue];
}
if(?newSubVer?>?curSubVer)
{
NSLog(@"當前版本低?唯鸭,需要更新");
[[NSUserDefaultsstandardUserDefaults]?removeObjectForKey:@"updateVersion"];
[[NSUserDefaultsstandardUserDefaults]?setObject:@"yes"forKey:@"updateVersion"];
NSLog(@"version?==?yes");
return;
}
elseif(?newSubVer?<?curSubVer)
{
NSLog(@"當前版本高?不需要更新");
[[NSUserDefaultsstandardUserDefaults]?removeObjectForKey:@"updateVersion"];
[[NSUserDefaultsstandardUserDefaults]?setObject:@"no"forKey:@"updateVersion"];
return;
}
}
}
有意見小伙伴多多指導须蜗,反正我是只只吃菜的鳥