somerandomusername
somerandomusername

Reputation: 2023

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

enter image description here

I have set the file in Build Settings:

enter image description here

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:

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) {
    }
}

Upvotes: 1

Views: 530

Answers (1)

Aleksey Potapov
Aleksey Potapov

Reputation: 3783

Add your Objective-C files into Xcode->Targets->Build Phases->Compile Sources.

Upvotes: 4

Related Questions