It gives errors when using Swift Static library with Objective-C project

前端 未结 5 1408
闹比i
闹比i 2020-12-13 18:44

I need to make swift static library for my requirement. I made swift static library which uses swift and Obj-c code. I have included Obj-c files via bridge file. I am able t

相关标签:
5条回答
  • 2020-12-13 19:07
    1. Right click on your project name and select new file
    2. Create an empty "Swift File" called File.Swift
    3. It will prompt to create a bridge header file then click create
    0 讨论(0)
  • 2020-12-13 19:17

    I've got the same error on my demo project when added first Swift file in my pod compiled as static library. For me solution was simple - just added empty Swift file to my demo project which was previously in Objective-C only. This solved all linker errors.

    0 讨论(0)
  • 2020-12-13 19:26

    If create empty "Swift File" errors

    This method may be useful, can try : https://blog.cpming.top/p/react-native-0-62-undefined-symbol

    0 讨论(0)
  • 2020-12-13 19:28

    An update to Alex's answer:

    In my case it was a React-Native project after adding a Swift Pods library. Maybe just the step 2 can work:

    1. Adding a new Swift file and a Brigde header:

    1) File -> New -> File

    2) Select Swift File

    3) Confirm Create Bridging Header

    1. Go to Build Settings and set Always Embed Swift Standard Libraries to YES
    0 讨论(0)
  • 2020-12-13 19:28

    This answer worked for me: Add $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) to the library search paths.

    0 讨论(0)
提交回复
热议问题