Swift 编译器错误:使用未解析的标识符“名称" [英] Swift Compiler Error: Use of unresolved identifier 'name'

查看:17
本文介绍了Swift 编译器错误:使用未解析的标识符“名称"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试包含一个名为name"的类,但出现错误:

I tried to include a class called 'name' and I got an error:

Swift Compiler Error: Use of unresolved identifier 'name'

该类存在并且不包含任何编译错误.

The class exists and doesn't contain any compile errors.

推荐答案

可能存在一些问题.

  1. 其中一个类有测试目标,而另一个没有.您甚至必须将所有类都包含在测试目标中,或者一个都不包含.

  1. One of the classes has a Testing target and other one doesn't. You have to even include all of your classes in the testing target or none of them.

如果是 Objective C 类,请检查该类是否在 ObjectiveC 桥接头文件中.

If it's Objective C class, check that the class is in ObjectiveC bridging header file.

如果是 NSManagedObject 子类.在类声明前添加@objc(className).

If it's NSManagedObject subclass. Add @objc(className) before the class declaration.

如果它是不同框架的一部分,请确保类或函数是public

If it's part of a different framework, make sure that the class or function is public

这篇关于Swift 编译器错误:使用未解析的标识符“名称"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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