2015-04-05 57 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