2015-04-05 66 views
2

我写了一个使用Parse.com的iOS应用程序。当我需要更改关于用户的信息时,我使用refreshInBackgroundWithBlock。我现在正在为Mac OS X编写应用程序,但我似乎无法使用refreshInBackgroundWithBlock。有什么建议么?Parse.com刷新用户信息

以下是下面的代码。

//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!") 
    } 

} 
+1

Parse的文档说了什么? – nhgrif 2015-04-05 23:35:20

+0

iOS和OSX似乎是一样的。在Mac上,我看到''PFUser'没有名为'refreshInBackgroundWithBlock'的成员。 – 2015-04-05 23:36:45

+0

我强烈建议实际发布您的实际代码,这是产生错误。 – nhgrif 2015-04-05 23:37:45

回答

2

根据解析文档,refreshInBackgroundWithBlock已被废弃,由fetchInBackgroundWithBlockSee this)取代

所以你不需要调用refreshInBackgroundWithBlock