2017-03-01 23 views
0

我想通知用戶,如果有我的應用程序的新版本在App store.So我用下面的網址來驗證我的應用程序任何適當的方法來通知應用程序內的用戶如果在App Store iOS中可用的更新版本的應用程序?

http://itunes.apple.com/lookup?id=APPLEID

我得到了休息這樣

的當前版本和現有版本
{ 
"resultCount":0, 
"results": [] 
} 

有時我得到適當的休息,但有時not.Is有任何替代實現iOS應用

+1

看到這個http://stackoverflow.com/questions/6256748/check-if-my-app-has-a-new-version-on-appstore –

+0

HTTPS ://github.com/nicklockwood/iVersion 或者您可以使用此更新管理器 https://gist.github.com/fahadjamal/c6ee03e790c1b3c22d4f04fc5a09ccb0 –

+0

赦免.......... –

回答

1

使用Harpy庫此功能在新版本可供下載時獲得更新。

查找示例項目,使用和安裝在github上的鏈接

Link for download harpy library

您可以通過Cocoapods得到它或將文件添加到您的項目

+0

讓我試試這個庫 – Balaji

+0

讓我知道執行後的狀態 – Himanth

+0

這也行不通,我越來越喜歡這個 [harpy]:storeUR L:https://itunes.apple.com/lookup?bundleId=com.app.appname 2017-03-01 17:40:17.737808 appname [2798:957080] [Harpy]:JSON結果:{ resultCount = 0 ; results =( ); } – Balaji

0

而不是檢查應用程序ID,你可以比較bundleId通知用戶可以下載新版本。

你可以試試這個:

-(void) checkForNewVersion{ 

    NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary]; 

    NSString* appID = infoDictionary[@"CFBundleIdentifier"]; 

    NSURL* url = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@", appID]]; 

    NSData* data = [NSData dataWithContentsOfURL:url]; 

    if(data != nil) 
    { 

     NSDictionary* lookup = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; 

     if ([lookup[@"resultCount"] integerValue] == 1){ 

      NSString* appStoreVersion = lookup[@"results"][0][@"version"]; 

      NSString* currentVersion = infoDictionary[@"CFBundleShortVersionString"]; 

      if ([appStoreVersion compare:currentVersion options:NSNumericSearch] == NSOrderedDescending) { 
       // Alert View 

      } 

     } 
    } 
} 
+0

已經嘗試過這種方法,但有時候我沒有使用這個URL獲得價值http://itunes.apple.com/lookup?bundleId=AppleID – Balaji

+0

你可以使用'Harpy':這個模塊觸發一個UIAlertView,當一個新的您的應用程序版本可在App Store上找到。 –

+0

Harpy也沒有工作,我越來越喜歡這個 [Harpy]:storeURL:https://itunes.apple.com/lookup?bundleId=com.app.appname 2017-03-01 17:40:17.737808 appname [2798:957080] [Harpy]:JSON結果:resultCount = 0; results =( ); } – Balaji

相關問題