预期类型&导入桥接头失败 [英] Expected a type & Failed to import bridging header

查看:90
本文介绍了预期类型&导入桥接头失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个包含Swift和Objective_C代码的项目,直到我尝试在我的 Bridging-Header文件中导入 .h类之前,它都可以正常工作。

I'm working on a project that contains Swift and Objective_C code, it works without any problem until i was trying to import a ".h" class in my "Bridging-Header" file:


  • 期望类型:在我尝试导入的类中

  • 无法导入桥接头文件'/ Users / sysadmin / Desktop / Application /Classes/UI/Application-Bridging-Header.h'

  • Expected a type : in the class that i was trying to import it
  • Failed to import bridging header '/Users/sysadmin/Desktop/Application /Classes/UI/Application-Bridging-Header.h'

但是,当我在Bridging Header中导入了另一个没有问题的类时!

however when i have imported an other class in Bridging Header that works without problem!

推荐答案

在Swift项目中,有3种方法可以导入目标c文件。

There is 3 ways to import objective c file in Swift project.


  1. #import FileName.h

  2. #import< ; FolderName / FileName.h>

  3. @import PackageName; @进口Alamofire;

  1. #import "FileName.h"
  2. #import <FolderName/FileName.h>
  3. @import PackageName; like @import Alamofire;

这篇关于预期类型&amp;导入桥接头失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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