10

I have checked the (Top Paid Apps) sample code from Apple website where you can see all the top apps in the App store, I want to do the same in my app but to show only my apps in the App Store. Here is the URL which i found in that sample :

http://phobos.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/toppaidapplications/limit=75/xml

What do I need to change in this URL to show only my Apps?

4slices
  • 241
  • 6
  • 15

2 Answers2

22

This is pretty easy with the SKStoreProductViewController introduced in iOS 6. With that users can buy your other apps right within the application.

First add StoreKit.framework to your project. Then find the iTunes URL that links to your apps using iTunes. You can copy the link from the iTunes Store. For example the URL for the Apple apps is http://itunes.apple.com/de/artist/apple/id284417353?mt=12 It contains the iTunes identifier, that you pass to the SKStoreProductViewController.

Sample code:

#import "ViewController.h"
#import <StoreKit/SKStoreProductViewController.h>

@interface ViewController ()<SKStoreProductViewControllerDelegate>
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self showMyApps];
}

-(void)showMyApps
{
    SKStoreProductViewController* spvc = [[SKStoreProductViewController alloc] init];
    [spvc loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @284417353}
                    completionBlock:nil];
    spvc.delegate = self;
    [self presentViewController:spvc animated:YES completion:nil];

}

-(void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
Felix
  • 35,354
  • 13
  • 96
  • 143
  • First I would like to thank you for the detailed answer and it works fine in iOS 6 simulator but not working for the earlier iOS is there any way to make available for all devices that running earlier iOS. – 4slices Oct 10 '12 at 17:51
  • No, this feature is only available on iOS 6. In earlier versions you could link to the App Store: `[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/de/artist/apple/id284417353?mt=12"]]` – Felix Oct 10 '12 at 19:21
  • But how can I do it since my app is crashing on earlier ios after adding the code above. – 4slices Oct 10 '12 at 19:46
  • Plus the URL is located on you comment will take the user out of my app to iTunes built in app which I don't want to do.Have you took a look on the Top Paid sample code I have mentioned on my question before? I know that they removed it but I don't know why . This was what I want to do exactly and it is working on all ios. – 4slices Oct 10 '12 at 19:49
  • Works but first app is covered by navigation bar. –  Dec 24 '18 at 02:47
0

You could use DAAppsViewController. It can be configured with a developer ID to show all the apps by that developer. It will use StoreKit if available, otherwise fallback to switching to the App Store.

Ric Santos
  • 15,419
  • 6
  • 50
  • 75