[英]Failing trying to use Objective-C library in my Swift project with bridging header
I think I have completed all the necessary steps for this, but it fails for some reason.我想我已经完成了所有必要的步骤,但由于某种原因它失败了。 This is the error I get:
这是我得到的错误:
Showing All Messages Undefined symbol: _OBJC_CLASS_$_HCKBeaconCentralManager
显示所有消息未定义符号:_OBJC_CLASS_$_HCKBeaconCentralManager
I have set the file in Build Settings:我已经在构建设置中设置了文件:
This is the content of bridge file:这是桥文件的内容:
#import "HCKBeaconCentralManager.h"
#import "HCKBeaconInterface.h"
#import "HCKBeaconBaseModel.h"
#import "HCKBeaconProtocol.h"
Just in case this is code I use to try to call the SDK classes:以防万一这是我用来尝试调用 SDK 类的代码:
import UIKit
import SwiftUI
import CoreLocation
import CoreBluetooth
@available(iOS 13.0, *)
class SceneDelegate: UIResponder, UIWindowSceneDelegate,HCKCentralScanDelegate {
func centralManagerScanNewDeviceModel(_ beaconModel: HCKBeaconBaseModel!, manager: HCKBeaconCentralManager!) {
print("centralManagerScanNewDeviceModel")
}
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
print("scene init")
HCKBeaconCentralManager.sharedInstance()?.scanDelegate = self
}
func sceneDidDisconnect(_ scene: UIScene) {
}
func sceneDidBecomeActive(_ scene: UIScene) {
}
func sceneWillResignActive(_ scene: UIScene) {
}
func sceneWillEnterForeground(_ scene: UIScene) {
}
func sceneDidEnterBackground(_ scene: UIScene) {
}
}
将您的 Objective-C 文件添加到 Xcode->Targets->Build Phases->Compile Sources。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.