swift 调用 oc [cannot find interface declaration for ‘ BaseViewModel’ , superclass of ‘indexViewModel’
来源:互联网 发布:网络拓扑图图标素材 编辑:程序博客网 时间:2024/05/17 00:13
看报错,indexViewMode找不到父类BaseViewModel
在桥接文件里 有#import "IndexViewModel.h"
,没有baseviewmodel,然后加上了#import "BaseViewModel.h"
现在桥接文件是这样
#import "IndexViewModel.h"#import "BaseViewModel.h"
依然报同样的错误
这是因为 桥接文件在 编译的时候,是从上到下按顺序编译的,编译IndexViewModel.h
的时候,父类在下面还没编译到,所以报同样的错误。
所以 swift在调用oc文件的时候, 如果oc文件有父类,需要先引入父类,在引入子类,这样才不会报错。
桥接文件最终修改为
#import "BaseViewModel.h"#import "IndexViewModel.h"
编译通过了
1 0
- swift 调用 oc [cannot find interface declaration for ‘ BaseViewModel’ , superclass of ‘indexViewModel’
- Cannot find interface declaration for “类B”,superclass of “类A”
- 带有framework时,OC/swift混合编译时,报错MyClass is unavailable: cannot find Swift declaration for this class
- Static Library: Cannot find interface declaration for 'UIImage'
- Cannot find interface declaration for 'NSObject'报错
- iOS集成支付宝遇到的问题一:Cannot find interface declarationfor'NSObject', superclass of'Base64'
- Cannot find the declaration of element 'beans'
- Cannot find the declaration of element 'beans'
- Cannot find the declaration of element 'beans'
- Cannot find the declaration of element 'beans'
- cannot find protocol declaration for "RefreshAudioListViewDelegate"
- cannot find protocol declaration for "RefreshAudioListViewDelegate”
- ios error:Cannot find protocol declaration for
- cannot find coclass for interface....解决方法
- <Cannot find protocol declaration>
- Cannot find the declaration of element 'beans'. 的解决方法
- Cannot find the declaration of element 'beans'. 的解决方法
- Cannot find the declaration of element 'beans'. 的解决方法
- 股票数量价格加减控件
- 开源|2017 CVPR(Oral Paper):多目标实时体态估测 项目开源
- 中考将至,初三孩子中考真题卷模考卷讲解提分
- Java中自定义有序不重复的集合——SetList
- SurfaceFlinger: hwcomposer module not found
- swift 调用 oc [cannot find interface declaration for ‘ BaseViewModel’ , superclass of ‘indexViewModel’
- React Native应用部署/热更新-CodePush最新集成总结(新)
- 西瓜书第三章 线性模型
- ERP浅谈之报表开发上
- Java 集合体系详解——List体系有序集合
- ABP学习笔记之搭建APB框架
- Oracle 自定义异常
- 为一个物体添加子物体
- JAVA知识之多线程(一):基础知识