无法从自定义动态框架(Swift)访问类 [英] Can't access class from custom dynamic framework (Swift)

查看:115
本文介绍了无法从自定义动态框架(Swift)访问类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的测试动态iOS框架 XYZFramework 由单个类 XYZ 组成。

My test dynamic iOS framework XYZFramework consists of a single class XYZ.

但是,即使在声明之后:

However, even after declaring:

import XYZFramework

我无法访问此类,任何尝试都会产生以下错误:

I am unable to access this class, with any attempts yielding the following error:

Use of unresolved identifier 'XYZ'

如何解决此问题?

推荐答案

找到答案。我必须使用 public 修饰符为我的类声明添加前缀。所以这个:

Found the answer. I had to prefix my class declaration with the public modifier. So this:

class XYZ
{

}

成为:

public class XYZ
{

}

并且一如既往地捣毁〜/ Library / Developer / Xcode / DerivedData 文件夹修复了任何轻微的并发症。

And, as always, trashing the ~/Library/Developer/Xcode/DerivedData folder fixed any minor complications.

这篇关于无法从自定义动态框架(Swift)访问类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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