Vidhi Vidhi - 9 months ago 51
iOS Question

open appstore as model view opens blank page ios

I am tring to open appstore page as model view inside application using following code

[NSDictionary dictionaryWithObject:@"APPID" forKey:SKStoreProductParameterITunesItemIdentifier];

SKStoreProductViewController *productViewController = [[SKStoreProductViewController alloc] init];
[self presentViewController:productViewController animated:YES completion:nil];

but when appstore is open inside application, it is opening as blank page.
Please refer screenshoot attachedBlank appstore page when opened as model view

I dont understand why appstore page of my app is not opening. I am passing APPID in above code.

Is there any other way to rate application without closing app ?

Answer Source

basically, something like this could help on you, after you linked the StoreKit.framework to your project. please note, it may not be working on simulator; on real device it works well.


@interface UIYourViewController : UIViewController <SKStoreProductViewControllerDelegate> { }


- (void)myOwnCustomMethod {

    SKStoreProductViewController *_controller = [[SKStoreProductViewController alloc] init];
    [_controller setDelegate:self];
    [_controller loadProductWithParameters:[NSDictionary dictionaryWithObjectsAndKeys:@"364709193", SKStoreProductParameterITunesItemIdentifier, nil] completionBlock:^(BOOL result, NSError *error) {
        if (result) {
            [self.navigationController presentViewController:_controller animated:TRUE completion:nil];
        } else {
            // you can handle the error here, if you'd like to.


#pragma mark - <SKStoreProductViewControllerDelegate>

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