Parse, how to count, put data in an array, then show the content of the array

烈酒焚心 提交于 2019-12-25 03:55:51

问题


I need to check for, and then show, the number of objects in a Parse class in a fixed tableView, each object has a "guide" keyword, and each row of the tableView is named after those keywords.

problem: Can't add data to the array

my idea is to search for them, put result in an array:

var totalOfTotalArray : [Int] = []

and then, in order to show numbers one by one, each row will have:

  switch indexPath.row {
    cell.guideNumberOfMexLabel.text = String(self.totalOfTotalArray[indexPath.row])

    }

this is the query

for pfKeyword in KeyWords.guideKeywordArray {


                var findHowManyMexQuery = PFQuery(className: KeyWords.ParseClassForPublicMessages)

                findHowManyMexQuery.whereKey("guide", containsString: pfKeyword) //MARK: - filter for Parse - should filter parse query
                findHowManyMexQuery.whereKey("messagePosition", nearGeoPoint: PFGeoPoint(location: myPosition), withinKilometers: kRadiusMessages) //MARK: geolocalized filter

                findHowManyMexQuery.countObjectsInBackgroundWithBlock {
                    (count: Int32, error: NSError?) -> Void in
                    if error == nil {

                        self.totalOfTotalArray.append(Int(count)) //Array never filled up


                    }
                }



            }

来源:https://stackoverflow.com/questions/33319345/parse-how-to-count-put-data-in-an-array-then-show-the-content-of-the-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!