【发布时间】:2016-08-10 00:56:50
【问题描述】:
我目前正在实施应用内购买机制,有三件事我不完全了解。
在下面的 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
}
【问题讨论】:
-
阅读
SKProduct的文档以了解localizedTitle和localizedDescription是什么。 -
阅读 Swift 编程语言的基础知识以了解
as! SKProduct的含义。 -
感谢您为我指明了正确的方向,我查看了错误的文档...developer.apple.com/reference/foundation/nserror/…
标签: ios swift uitableview in-app-purchase skproduct