Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<In App Purchase> how to generate a SKProduct directly

recently I working on IAP. As you know, when you want to send a payment request, you should call

+ (id)paymentWithProduct:(SKProduct *)product

but I found only way to get product is using SKProductsRequest, is there any way to generate SKProduct directly? just like the deprecated one,

+ (id)paymentWithProductIdentifier:(NSString *)identifier

The fact is I want a new SKProduct object directly using product id.

BR, Roger

like image 319
Roger Lee Avatar asked Oct 26 '12 16:10

Roger Lee


People also ask

How do you make an in-app purchase?

On the Google Play Store app, in-app purchases will be by the Price or Install button. On play.google.com/store, you'll see "Offers in-app purchases" below the name of the app.

How do in-app purchases work?

In-app purchases allow developers to offer the app for free in the App Store (for iOS) and Google Play (for Android). Then, within the application, they can upsell and advertise paid upgrades, locked features, special items, and other premium offers.

How does in-app purchase work iOS?

In-app purchases are extra content or subscriptions that you buy inside an app. Not all apps offer in-app purchases. To check if an app offers in-app purchases before you buy or download it, find it in the App Store. Then look for "In-App Purchases" near the app's price or Get button.


1 Answers

I use this to buy a product without fetching all the products from iTunes:

  - (void)buyProductIdentifier:(NSString *)productIdentifier 
{
    SKMutablePayment *payment = [[SKMutablePayment alloc] init] ;
    payment.productIdentifier = productIdentifier;
    [[SKPaymentQueue defaultQueue] addPayment:payment];
}
like image 172
Aracet Avatar answered Nov 21 '22 01:11

Aracet