我目前正在实现应用内购买机制,但有三件事我没有完全理解。
在下面的 tableView 中,我使用单例类从应用 Storm 中检索产品,有三件事我不确定它们到底做了什么......
什么是 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
}
最佳答案
谢谢 rmaddy
为我指明了正确的方向,我正在看错误的文档... https://developer.apple.com/reference/foundation/nserror/1414418-localizeddescription
localizedTitle 和 localizedDescription: https://developer.apple.com/library/ios/documentation/StoreKit/Reference/SKProduct_Reference/#//apple_ref/occ/instp/SKProduct/localizedDescription
作为: https://developer.apple.com/swift/blog/?id=23
谢谢
关于ios - 了解 TableView 中的 localizedTitle 和 localizedDescription,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38862639/