任何适当的方法来通知应用程序内的用户如果在App Store iOS中可用的更新版本的应用程序?

问题描述:

我想通知用户,如果有我的应用程序的新版本在App store.So我用下面的网址来验证我的应用程序任何适当的方法来通知应用程序内的用户如果在App Store iOS中可用的更新版本的应用程序?

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

我得到了休息这样

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

有时我得到适当的休息,但有时not.Is有任何替代实现iOS应用

+1

看到这个http://*.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

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

使用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

而不是检查应用程序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