Search code examples
ipadstorekitios-extensions

SKStoreProductViewController in iOS 8 Actions Extension


I'm working on an iOS Action Extension that's capable of showing an SKStoreProductViewController. Action Extensions are capable of showing in two sizes, either full screen (NSExtensionActionWantsFullScreenPresentation set to YES) or in a small centered window in the screen (set to NO). I'm opting for the minimal window in the middle, my extension doesn't warrant use of the full screen.

When I show an SKStoreProductViewController modally within my extension as prescribed it ends up large and clipped in the center of the action extension. Has anybody else encountered this or found a way around it?

enter image description here


Solution

  • With NSExtensionActionWantsFullScreenPresentation set to YES, the extension behaves like a UIModalPresentationStyleFormSheet thus:

    override func viewDidLoad() {  
        super.viewDidLoad()  
        preferredContentSize = CGSize(width: 540, height: 620)  
    }
    

    Note that the extension is displayed full screen on an iPhone (as expected).

    References: