0

I have an application that after a button click sends the client to the AppStore in order to download an new app. This is done with the following code:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://ax.itunes.apple.com/app/yyy-mobile/id4xxxxx89"]]; 

This line of code worked fine until iOS6, but after the latest v7 iOS SDK the code broke.

How do we resolve the issue? Do we need an if/else logic checking if the device has iOS 7 installed? For example:

if( iOS < 7 ) { // keep old logic 
     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://ax.itunes.apple.com/app/yyy-mobile/id4xxxxx89"]]; } 
else // new logic for iOS 7  
     //TBD 
}

Or it would be better to replace the old line with new code that does the job for iOS7 and iOS6 (ie, a new method that is backwards compatible)?

user7388
  • 1,741
  • 2
  • 19
  • 25
cateof
  • 6,608
  • 25
  • 79
  • 153

1 Answers1

0

I can recommend using the iOS 6+ SKStoreProductViewController as seen in the Appirater project: https://github.com/arashpayan/appirater/blob/master/Appirater.m#L485 (+rateApp)

It will show the app store window right inside your app, which is much faster than the old solution using -openURL

KrauseFx
  • 11,551
  • 7
  • 46
  • 53
  • Thank you, but I don't want this solution. I want the AppStore to be opened in a separate app – cateof Nov 11 '13 at 12:29
  • Have you tried the URL used in Appirater for iOS 7? NSString *templateReviewURLiOS7 = @"itms-apps://itunes.apple.com/app/idAPP_ID"; – KrauseFx Nov 11 '13 at 13:20
  • I have tried it with iOS6 and it worked. If this works with iOS7 I will use this string, since I don't need an if/else snippet – cateof Nov 11 '13 at 13:32