gpt4 book ai didi

ios - 找不到 Objective C 桥接头文件

转载 作者:搜寻专家 更新时间:2023-11-01 06:28:33 27 4
gpt4 key购买 nike

我有一个使用 swift 类对象的类名 AppState

#import "Sonic-Swift.h"

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

现在我需要在 swift 文件中使用这个类 (AppState)。所以我试图在桥接 header 中导入此类。

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

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 文件中。

如果你想在 .h 文件中使用 Swift 类,那么你应该使用

@class MySwiftClass;

关于ios - 找不到 Objective C 桥接头文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50507433/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com