Objective C bridging header file not found

南笙酒味 提交于 2019-12-11 07:36:44

问题


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;

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

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'

回答1:


import "Sonic-Swift.h" 

should be in .m file only.

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

@class MySwiftClass;


来源:https://stackoverflow.com/questions/50507433/objective-c-bridging-header-file-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!