1

我目前正在实施应用内购买机制,有三件事我不完全理解。

在下面的 tableView 中,我正在使用单例类从应用程序风暴中检索产品,并且有三件事我不确定它们到底做了什么......

做什么as! SKProduct

做什么localizedTitlelocalizedDescription做什么?

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
}
4

1 回答 1

0

感谢您rmaddy为我指出正确的方向我查看了错误的文档... https://developer.apple.com/reference/foundation/nserror/1414418-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

谢谢

于 2016-08-10T01:11:48.173 回答