I get an error saying "Cannot invoke initializer for type 'SKProductsRequest' with an argument list of type'(productsIdentifier: Set)' and I'm still trying to learn the syntax changes. Any help?
if(SKPaymentQueue.canMakePayments()) {
let productID:NSSet = NSSet(objects: "com.organization.appname.iap")
let request: SKProductsRequest = SKProductsRequest(productIdentifier: productID as Set<NSObject>)
request.delegate = self
request.start()
}
Cast it as Set<String>
and it will work fine.
Here is new code:
let productID:NSSet = NSSet(objects: "com.organization.appname.iap")
let request: SKProductsRequest = SKProductsRequest(productIdentifiers: (productID as! Set<String>))
Syntax is changed for 2.0:
// request information about products for your application
@available(iOS 3.0, *)
public class SKProductsRequest : SKRequest {
// Set of string product identifiers
@available(iOS 3.0, *)
public init(productIdentifiers: Set<String>) //Set<NSObject> will not work anymore
@available(iOS 3.0, *)
unowned(unsafe) public var delegate: SKProductsRequestDelegate?
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.