In-App Purchase Tutorial: Getting Started

I have problems trying to make a dynamic list of products. I do get this error.
Cannot convert value of type ‘[String]’ to specified type ‘Set’ (aka Set')
What can I do?

public static let Products = ProductList.Products //output is array of String

fileprivate static let productIdentifiers: Set = Products

public static let store = IAPHelper(productIds: RageProducts.productIdentifiers)

Ok we save locally the purchase in purchasedProductIdentifiers to avoir reasking each time apple server. But how to reset purchasedProductIdentifiers when for the user logout from its App Store user account and an other account is used ?

Hi. Tell me please is there a place where I can find the original objective-c tutorial?

In the example project, the initial value of GirlfriendOfDrummerRage variable in RageProducts.swift is:
GirlfriendOfDrummerRage
but in the iTunes Connect, we create it as:
GirlFriendOfDrummerRage
That is, the ‘F’ of “Girlfriend” is upper case in iTunes Connect, but lower case in RageProducts.swift.

This discrepancy got me initially. Please fix the starter project.

Regards

Hey, great tutorial, helped me a lot with my first 2 iOS apps. But I have a huge problem with in app promo codes restore. If user buys the in app purchase, everything works great - first buy, restore and all. Same in case of sandbox. But in case user redeems the promo code for in app, nothing happens when tapping on restore button. Moreover when user clicks on “buy” button, there’s an alert that this item was already bought (via code) and will be restored. But as mentioned before, restore callback is never called. Please advice. Thanks.

1 Like

Same here. Have you found the solution? Thanks.

No, I haven’t. I have no idea how to debug promo codes in sandbox environment.
As a workaround I’ve set a price of in app purchase to free for first 2 weeks, so everyone can test the full possibilities of the app.

I’ve created IAPHelper object in AppDelegate’s didFinishLaunchingWithOptions method and added it as an observer. So as Apple’s best practice suggests, that will keep you up to date with any transactions your observer class couldn’t handle if it’s already deallocated. So, i hope that will help. Will come back for further news.

Seems like everything works! :slight_smile:

Do I need to fill all this banking and taxing stuff in iTunes Connect to at least test IAPs?

I’ve created a sandbox test user and a non-consumable product.
Logged off of the iTunes on my iPhone.

And when I request products from Apple - I always receive a response with empty products array.

How to " The list of product identifiers can be pulled from a web server "?

but how to pull from database, or json

Hello Did you ever get this to work from a server!?

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]