我编写了一个使用 Parse.com 的 iOS 应用程序。当我需要更改有关用户的信息时,我使用 refreshInBackgroundWithBlock
。我现在正在为 Mac OS X 编写应用程序,但我似乎无法使用 refreshInBackgroundWithBlock
。有什么建议吗?
下面是代码。
//Refresh the User Info
currentUser.refreshInBackgroundWithBlock { (object, error) -> Void in
//Fetch the User Info
currentUser.fetchIfNeededInBackgroundWithBlock { (result, error) -> Void in
//Check if the comments read is nil
if object.objectForKey("commentsRead") === nil {
println("Comments Read is empty")
} else {
var currentRead:[Int] = []
//If not empty assign the array to the value
currentRead = object.objectForKey("commentsRead") as Array
currentRead.append(0)
var user = PFUser.currentUser()
user.setObject(currentRead, forKey: "commentsRead")
user.saveInBackgroundWithBlock { (result, error) -> Void in
println("Completed!")
}
}
最佳答案
根据解析文档,refreshInBackgroundWithBlock
已弃用,并替换为 fetchInBackgroundWithBlock
( See this )
所以你不需要调用refreshInBackgroundWithBlock
。
关于macos - Parse.com 刷新用户信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29463437/