這有幫助嗎?
let query = PFQuery("Account")
query.findObjectsInBackgroundWithBlock { (objects, error) in
// Retrieve the checking and savings balances
var checkingBalance: Float!
var savingsBalance: Float!
if objects != nil {
for object in objects as [PFObject] {
switch object["type"] {
case "startingBalance":
checkingBalance = object["startingBalance"] as Float
case "startingBalance":
savingsBalance = object["startingBalance"] as Float
default:
fatalError("invalid account type")
}
}
}
if checkingBalance != nil && savingsBalance != nil {
// Assuming you already know the transaction locally:
checkingBalance += checkingTransactionAmount // e.g., -3.14
savingsBalance += savingsTransactionAmount
} else {
println("unable to retrieve checking balance or savings balance (\(checkingBalance), \(savingsBalance))")
}
}
查詢所有帳戶將只返回當前用戶的假設其ACL已正確設置。
你到目前爲止嘗試過什麼.. ?? – 2014-09-30 15:02:31
你的問題是什麼?到目前爲止,這是一個需求清單。 – rmaddy 2014-09-30 15:21:01