How to import framework into XCode project?

Viewed 2320

I get No such module 'BRLMPrinterKit' error.

I take a reference from official document https://support.brother.com/g/s/es/htmldoc/mobilesdk/guide/getting-started/getting-started-ios.html to import framework.

Here is my step:

  1. drag BRLMPrinterKit.framework and BRLMPrinterKitW.framework into my framework folder enter image description here

  2. Check they are in Link Binary With Libraries (remove and drag again) enter image description here

  3. Check Framework Search Paths (I'm not sure it correct or not) enter image description here

  4. Check Header Search Paths (I'm not sure it correct or not) enter image description here

Finally I clean and build get No such module 'BRLMPrinterKit' error.

I have no idea how to fix my import problem, any help would be appreciated. Thanks.

3 Answers

That's not a Swift module, so first, you need to create a bridging header, in which you import <BRLMPrinterKit/BRLMPrinterKit.h>, then you can use the BRLM classes in your Swift files.

  1. using CocoaPods to install the 'BRLMPrinterKit' framework.
  2. add the bridge file.(Targets > Build Settings > Swift Compiler - General > Objective-C Bridgeing Header) enter image description here

the bridge file.h

#ifndef PtouchPrinterKit_Bridging_Header_h
#define PtouchPrinterKit_Bridging_Header_h

#import <BRLMPrinterKit/BRPtouchBluetoothManager.h>
#import <BRLMPrinterKit/BRPtouchDeviceInfo.h>
#import <BRLMPrinterKit/BRPtouchNetworkManager.h>
#import <BRLMPrinterKit/BRPtouchPrinter.h>
#import <BRLMPrinterKit/BRPtouchPrinterData.h>
#import <BRLMPrinterKit/BRPtouchPrinterKit.h>
#import <BRLMPrinterKit/BRPtouchPrintInfo.h>

#endif 

  1. then you can use the framework
Related