簡體   English   中英

從解析查詢加載UITableView

[英]load UITableView from parse query

這段代碼工作的部分時間,有時它返回一個空數組。我不知道為什么。我在viewWillAppear調用它。

func refreshFriendListFromLocalDatastore() {
    println("refreshing from local datastore")
    var friendRelations:PFRelation = currentUser.relationForKey("friendRelations") as PFRelation
    var query:PFQuery = friendRelations.query() as PFQuery
    query.orderByAscending("username")
    query.fromLocalDatastore()
    query.findObjectsInBackgroundWithBlock { (NSArray friends, NSError error) -> Void in
        if error == nil {
            self.friends = friends
            println("\(self.friends)")
            tableView.reloadData()
        } else {
            println("could not retrieve friend list at this time")
        }
    }
}

currentUser與使用pin固定到本地數據存儲的用戶沒有朋友關系。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM