iOS应用程序未从框架中看到公共协议 [英] iOS application doesn't see public protocol from framework

查看:86
本文介绍了iOS应用程序未从框架中看到公共协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了Static Framework,并将其添加到iOS应用中. 在框架中,我创建了新的公共协议:

I created Static Framework and added it to an iOS app. In Framework I created new public protocol:

public protocol ProtocolName
{
    func methodName1(arg1: Int)
}

我重建了框架,但无法在我的应用中使用此协议.

I rebuilt framework, but I can't use this protocol in my app.

import FrameworkName

class ClassName: ProtocolName
{
    func methodName1(arg1: Int)
}

(类定义中的错误:使用未声明的类型'ProtocolName')

(Error in class definition: Use of undeclared type 'ProtocolName')

该应用可以查看其他协议,其他类和视图.它还可以看到我框架的变化(我添加了一些测试打印和重建框架,以检查应用程序是否使用了新构建的版本,并且可以正常工作.)

The app sees other protocols, other classes and views. It also sees changes in my framework (I added some test print and rebuild framework to check if the app uses the newly built version and it works).

带有协议的文件位于框架的目标成员身份中. 我试图删除整个框架并再次链接它,关闭并重新打开XCode,清理两个项目几次,但是没有任何效果.

File with the protocol is in Target Membership for the framework. I tried to remove the whole framework and link it again, close and reopen XCode, clean both project few times, but nothing works.

我也尝试添加下一个协议-应用中也无法识别(但其他较旧的协议可以识别).

I tried also to add next protocol - also isn't recognized in the app (but other, older protocols are).

我在应用程序中检查了框架定义(右键单击一个模块,然后跳转到定义")-没有提及新协议.

I checked framework definition in the app (right click on a module and Jump to Definition) - there are no mentions of the new protocol.

我猜想框架元数据(类和方法定义)的生成有问题,但是我找不到解决它的方法.

I guess something is wrong with the generation of the framework metadata (classes and method definitions), but I can't find a way to fix it.

任何帮助或想法将不胜感激.

Any help or ideas would be appreciated.

推荐答案

好的,我想我可以将这个问题留给同样的问题(也许可以节省3-4个小时).

OK, I think I can leave this question for someone with the same problem (maybe will save 3-4 hours).

解决方案非常简单:删除项目和框架的派生数据(也许删除应用程序的派生数据就足够了,但是我删除了两者,所以我不知道).

The solution was quite simple: remove Derived Data for project and framework (maybe removing derived data for an app will be enough, but I removed both so I can't tell).

如何在XCode中执行此操作: https://stackoverflow.com/a/39495772/5226328

How to do it in XCode: https://stackoverflow.com/a/39495772/5226328

这篇关于iOS应用程序未从框架中看到公共协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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