Enabling In-App purchase for custom keyboard iOS8

2019-05-16 04:28发布

问题:

I am building a custom keyboard for iOS and I want to know how can I enable in-app purchases for that? The documentation states that I can enable in-app purchases through the containing app, but I am not sure what that means (technically)?

Has anyone built iPhone extensions with in-app purchasing that could give me some guidance?

回答1:

An extension is bundled with an app. When the user downloads the containing app, the extensions are available for the user to add to their keyboard list, today view, etc. If you want to charge for a keyboard, currently the only way you can do that is by charging for an app that contains a keyboard extension.



回答2:

Just to make it clear, Inapp purchases from within any app extension including keyboards are not allowed and will cause your app to fail review. Inapp purchases must be done in the container app. Following are the current app extension review guidelines.

https://developer.apple.com/app-store/review/guidelines/

  1. Extensions

25.1 Apps hosting extensions must comply with the App Extension Programming Guide

25.2 Apps hosting extensions must provide some functionality (help screens, additional settings) or they will be rejected

25.3 Apps hosting extensions that include marketing, advertising, or in-app purchases in their extension view will be rejected

25.4 Keyboard extensions must provide a method for progressing to the next keyboard

25.5 Keyboard extensions must remain functional with no network access or they will be rejected

25.6 Keyboard extensions must provide Number and Decimal keyboard types as described in the App Extension Programming Guide or they will be rejected

25.7 Apps offering Keyboard extensions must have a primary category of Utilities and a privacy policy or they will be rejected

25.8 Apps offering Keyboard extensions may only collect user activity to enhance the functionality of their keyboard extension on the iOS device or they may be rejected



回答3:

I'm trying to do this too. I want to enable in-app purchase so people can buy extra stuff for the keyboard. I'm trying several ways can't get it to work. I think it might not be possible to directly do it from the keyboard.

First I tried directly making the in-app purchase from the keyboard:

- (IBAction) buySomething:(id)sender {
    SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObject:@"productid"]];
    request.delegate = self;
    [request start];
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
    // It never gets here.
}

Then I tried to see if I could launch the container app from the keyboard, but nothing happens. In the info.plist, I have URL types > Item 0 > URL Schemes > Item 0 > myurlscheme.

[self.extensionContext openURL:[NSURL URLWithString:@"myurlscheme://#"] completionHandler:nil];

All I can think is to simply show instructions to launch the container app, but I'd rather just make it paid app than do that.