这段代码在 Swift 2 中完美运行
override func prepare(for segue: UIStoryboardSegue?, sender: Any?) {
if (segue!.identifier == "FeedDetailSeg") {
let viewController:ItemDetail = segue!.destination as! ItemDetail
viewController.DetailItem = collectionItems![self.selectedRow]
if self.cognitoID == collectionItems![self.selectedRow].seller {
viewController.owned = true
}
else {
viewController.owned = false
}
//remove item from untapped
//appDelegate.untapped.removeAtIndex(self.selectedRow)
//collect view info
self.dataStash(collectionItems![self.selectedRow].ID, itemCondition: 2).continueWithBlock({
(task: BFTask!) -> BFTask! in
if (task.error != nil) {
print(task.error!.description)
} else {
print("DynamoDB save succeeded")
}
return nil;
})
}
}
现在在 Swift 3 中,我在线遇到错误
//collect view info
self.dataStash(collectionItems![self.selectedRow].ID, itemCondition: 2).continueWithBlock({
说:无法转换类型“(BFTask<_>!)-> BFTask!”的值 到预期的参数类型'(BFTask?) - > Any?!'
这是使用 AWS 将项目保存到 DynamoDB。