![](/img/trans.png)
[英]Parse SDK with iOS Device: Can't Load Data from Query onto 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.