我试图在swift中复制这个Objective C行:
SKProductsRequest *request = [[SKProductsRequest alloc]
initWithProductIdentifiers:[NSSet setWithObject:self.productID]];
苹果文档读到swift版本是:
init(productIdentifiers productIdentifiers: NSSet!)
所以我的尝试是
let productID:NSSet = NSSet("somevalue");
let request:SKProductsRequest = SKProductsRequest(productIdentifiers:init(productID));
任何人都可以看到我做错了吗?
答案 0 :(得分:3)
我相信你想要这段代码:
let productID = NSSet(object: "somevalue");
let request = SKProductsRequest(productIdentifiers: productID);