String not convertible to [AnyObject]

风格不统一 提交于 2019-12-25 01:23:40

问题


I have a string declared as var searchString = ""

I am trying to do parse query as shown below: query?.whereKey("username", containedIn: searchString)

What is the issue?

This is in Xcode 6.3 updated and also Swift 1.2.


回答1:


The function expects an array of AnyObjects, you supply a String. Simply wrap the string in an array...

query?.whereKey("username", containedIn: [searchString])


来源:https://stackoverflow.com/questions/29874174/string-not-convertible-to-anyobject

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