SKStoreProductViewController not showing anything

3.4k views Asked by At

I'm trying to present the App Store sheet from inside my app:

https://gist.github.com/valeIT/bf9b357d8ef470fc559c

My ViewController conforms to SKStoreProductViewControllerDelegate. It seems like the problem is in "loadProductWithParameters" since I've tried calling presentViewController from outside the completion block and it presents and dismisses just fine, just it's completely empty (a white screen). I've tried passing as dictionary both a string or an nsnumber but nothing changes. Any idea?

3

There are 3 answers

1
Guy Kogus On

I know this is question crazy old, but I'm having the same problem.

The only part of your gist that looks off is that, according to the docs, the value to SKStoreProductParameterITunesItemIdentifier should be of type NSNumber but you have supplied a String. Try changing it to

vc.loadProductWithParameters([SKStoreProductParameterITunesItemIdentifier : NSNumber(value: 364709193)]

and see if that works.

0
JBJr On

It appears that SKStoreProductViewController loadProductWithParameters: fails silently if there are no products to load... if the product is a Mac application or iPad-only and you're asking for it from an iPhone, or you ask for an iPhone-only app from an iPad, loadProductWithParameters just never returns.

The ol' tried-and-true UIApplication openURL: technique using the iTunes URL gets a response in every case reliably - even for Mac applications - via browser:

NSString *itunesiOSURL = @"https://itunes.apple.com/us/app/myiOSapp/id123456789?mt=8";
NSString *itunesMacURL = @"https://geo.itunes.apple.com/us/app/myMacApp/id123456789?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:itunesURL]];
1
Mr.Shah On

The SKStoreProductViewController class does not support subclassing or embedding, and must be used as-is.

Important

If you compile with the iOS 13 SDK, attempting to instantiate a subclass of SKStoreProductViewController results in a runtimeException.

Documentation