macos - Parse.com 刷新用户信息

标签 macos swift parse-platform refresh

我编写了一个使用 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/

相关文章:

ios - 在 SwiftUI 的 ListView 中使用可识别的对象集

node.js - 使用 Node.js 从 'named pipe'/fifo 读取

java - 如何在 OS X 中使用 Java 找到用户的 'Documents' 文件夹?

php - 在 Windows 以外的平台上使用 sqlsrv_connect

objective-c - 崩溃日志中的 "Application Specific Backtrace"是什么?

ios - 使用prepareForSegue从 TableView 详细信息披露中传递零数据

ios - Xcode 6 中的自定义字体 - Swift 不起作用

ios - 解析查询在重启时返回 PFObject 而不是子类

ios - 从类中检索所有 Parse 数据时出错

parse-platform - 解析后台作业可以向当前登录的所有用户发送消息吗?