在xcode 7.3.1中使用未解析的标识符'GMSPlacesClient' [英] Use of unresolved identifier 'GMSPlacesClient' in xcode 7.3.1

查看:185
本文介绍了在xcode 7.3.1中使用未解析的标识符'GMSPlacesClient'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

func searchBar(searchBar: UISearchBar,
    textDidChange searchText: String){

        let placesClient = GMSPlacesClient()
        placesClient.autocompleteQuery(searchText, bounds: nil, filter: nil) { (results, error:NSError?) -> Void in
            self.resultsArray.removeAll()
            if results == nil {
                return
            }
            for result in results!{
                if let result = result as? GMSAutocompletePrediction{
                    self.resultsArray.append(result.attributedFullText.string)
                }
            }
            self.searchResultController.reloadDataWithArray(self.resultsArray)
        }
}

我使用这种方法在谷歌地图中搜索地址。但是使用未解析的标识符'GMSPlacesClient'发现错误。如何解决此问题?

I used this method to searching address in google map. But Use of unresolved identifier 'GMSPlacesClient' error found. How could I resolve this?

推荐答案

使用未解析标识符'GMSPlacesClient' 错误。在这个线程中指出,它可能有一个测试目标,另一个没有。对于这种情况,您必须将所有类都包含在测试目标中,或者不包含任何类。

Use of unresolved identifier 'GMSPlacesClient' error probably occurs when your new class has a different Target(s) from the other one. It is stated in this thread that it might have a testing target and the other doesn't. For this case, you have to include all of your classes in the testing target or none of them.

这个 blog 也为错误使用未解析的标识符提供了可能的解决方案。将您的课程的访问控制更改为公开。此外,还可以用公共方式标记您打算测试的任何方法。也可以尝试添加您希望能够为测试目标编写单元测试的类。

This blog also gives possible solution for error, "Use of unresolved identifier". Change the access control on your class to public. Additionally, mark any methods you intend to test with public also. Try also to add the class(es) you want to be able to write unit tests for to the tests target.

您也可以检查相关SO问题。希望这有助于!

You can also check this related SO question. Hope this helps!

这篇关于在xcode 7.3.1中使用未解析的标识符'GMSPlacesClient'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆