我目前正在实施应用内购买机制,有三件事我不完全理解。
在下面的 tableView 中,我正在使用单例类从应用程序风暴中检索产品,并且有三件事我不确定它们到底做了什么......
做什么as! SKProduct
?
做什么localizedTitle
和localizedDescription
做什么?
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .Subtitle, reuseIdentifier: "reuseIdentifier")
// what does `as! SKProduct` do
let product = IAPManager.sharedInstance.products.objectAtIndex(indexPath.row) as! SKProduct
// what does localizedTitle do?
cell.textLabel!.text = product.localizedTitle
// what does localizedDescription do?
cell.detailTextLabel!.text = product.localizedDescription
return cell
}