I\'m trying to add in-app purchase to my app, following the techniques described here :
Introduction to In-App Purchases in iOS 6 Tutorial
I\'ve added a prod
Answer for Swift projects with same error:
My error was here:
//identifiers: [String]
let productIDs = Set(arrayLiteral: identifiers) as Set!
let request = SKProductsRequest(productIdentifiers: productIDs)
But this code will lead to an error with code = 0 message Cannot connect to iTunes Store. Let's look to the SKProductsRequest input argument type:
SKProductsRequest(productIdentifiers: Set
So, code above looks legit. But it doesn't! Swift Set is the problem, considering that in input argument we see Swift Set!
Found the answer while iterating some IAP lesson. Here is the working code:
let productIDs = NSSet(array: identifiers)
let request = SKProductsRequest(productIdentifiers: productIDs as! Set)
You must use NSSet for now, although Swift Set is already available and it's set as input argument type! Looks like a bug for me, I'll fire a bug.