在myproject-swift.h中找不到接口声明 [英] Cannot find interface declaration in myproject-swift.h

查看:292
本文介绍了在myproject-swift.h中找不到接口声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我 我在项目中使用XLPagerTabStrip pod

i有一个桥接标头,用于从swift到目标c myproject-swift.h

的集成

我无法构建项目,并且此错误总是弹出:

找不到接口声明 'ButtonBarPagerTabStripViewController',超类 'ParentViewController'

这是我的控制器

import Foundation
import UIKit
import XLPagerTabStrip

class ParentViewController: ButtonBarPagerTabStripViewController {

    override func viewDidLoad() {
        tabStripStyle()
        super.viewDidLoad()
        containerView.isScrollEnabled = false
    }
   } 

我到处都看到过这个问题,但在这里尚未得到回答:

迅速发现错误 SR-805 解决方案

您需要同时为框架和应用程序目标导入-Swift.h

例如:

    #import <UIKit/UIKit.h>
    #import <AVFoundation/AVFoundation.h>
    #import <Foundation/Foundation.h>
    #import "XLPagerTabStrip-Swift.h"
    #import "RealmSwift-Swift.h"
    ...... // Add all frameworks, subclasses, and dependance ios frameworks
    #import  "MyProject-Swift.h"

您可以阅读文章如何导入文件头和检查路径

I' m using XLPagerTabStrip pod in my project,

i have a bridging header for other purposes to integrate from swift to objective c myproject-swift.h

i cant build the project and this error always pops:

Cannot find interface declaration for 'ButtonBarPagerTabStripViewController', superclass of 'ParentViewController'

This is my Controller

import Foundation
import UIKit
import XLPagerTabStrip

class ParentViewController: ButtonBarPagerTabStripViewController {

    override func viewDidLoad() {
        tabStripStyle()
        super.viewDidLoad()
        containerView.isScrollEnabled = false
    }
   } 

I have seen this issue everywhere posted but its not yet answered here: 'Cannot find interface declaration' in auto-generated Swift bridging header

Bugs in swift SR-805 SR-5398

解决方案

You needed to import the -Swift.h for for both the framework and the app target

For Example :

    #import <UIKit/UIKit.h>
    #import <AVFoundation/AVFoundation.h>
    #import <Foundation/Foundation.h>
    #import "XLPagerTabStrip-Swift.h"
    #import "RealmSwift-Swift.h"
    ...... // Add all frameworks, subclasses, and dependance ios frameworks
    #import  "MyProject-Swift.h"

You can read this article How to import file header and check paths

这篇关于在myproject-swift.h中找不到接口声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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