swift如何将解析数列附加到数组中

时间:2016-03-17 13:56:58

标签: arrays xcode swift

我在解析中有一个存储数字的列。我一直试图将数字附加到这样的数组:

var likes = [Int]()

getPostsQuery.findObjectsInBackgroundWithBlock { (posts, error) -> Void in

        if let posts = posts {

            self.likes.removeAll(keepCapacity: true)

            for post in posts {

                self.likes.append((post["likes"] as? Int)!)
            }
        }
    }

但它不起作用,我收到此错误

enter image description here

我一直在寻找附加数字的正确方法,但没有运气。我也尝试了NSNumber,但仍然无法正常工作。请帮助谢谢!

0 个答案:

没有答案