问题
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