找不到目标C桥接头文件 [英] Objective C bridging header file not found

查看:91
本文介绍了找不到目标C桥接头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类名 AppState ,它使用一个快速的类对象

I have a class name AppState which is using a swift class object

#import "Sonic-Swift.h"

@interface AppState : NSObject
@property (class) NSMutableArray<"Swift class" *> *entity;

现在我需要使用此类( AppState )在swift文件中。因此,我试图在桥接头文件中导入此类。

Now I need to use this class (AppState) in the swift file. So I'm trying to import this class in the bridging header.

但是在导入此文件后,应用程序在 #import Sonic-Swift.h上给出了错误行找不到文件。

But after importing this file the app gives an error on the "#import "Sonic-Swift.h"" line "File not found".

failed to emit precompiled header '/Users/krishna_mac_2/Library/Developer/Xcode/DerivedData/Apps-gqelclyzwvyomhcchmjjsejrznaw/Build/Intermediates.noindex/PrecompiledHeaders/Sonic-Bridging-Header-swift_3RJ3MQEOEFTPD-clang_26Q2UBYWMY12Y.pch' for bridging header '/Users/krishna_mac_2/Documents/Documents/Documents/Documents/Documents/Github/Sonic/iOS/Sonic/Sonic-Bridging-Header.h'


推荐答案

import "Sonic-Swift.h" 

应位于 .m

should be in .m file only.

如果要在 .h 文件中使用Swift类,则应使用code>文件。使用

If you want to use Swift class in .h file then you should use

@class MySwiftClass;

这篇关于找不到目标C桥接头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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