Why linker link static libraries with errors? iOS

后端 未结 17 1288
自闭症患者
自闭症患者 2020-11-27 14:39

I have a problem with linking my mixed language framework to a project.

1) I create a framework with Swift and Objective-C classes.

2) The main logic was stored in the

相关标签:
17条回答
  • 2020-11-27 14:55

    Apparently for pure objective-c projects you will need to add this $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) to the library search paths of your target. This worked for me when I was including a library written in swift to a project in objective-c

    0 讨论(0)
  • 2020-11-27 14:58

    If you have issue after update xCode to version 12 and errors

    Could not find or use auto-linked library 'swiftWebKit'

    and two more.

    Just affffd $(SDKROOT)/usr/lib/swift to the Build settings > Search paths > Library search paths.

    Hope its help :)

    0 讨论(0)
  • 2020-11-27 15:00

    Try this workaround https://stackoverflow.com/a/50495316/1658268

    Basically just add a dummy swift file in your project, and re-run your build.

    0 讨论(0)
  • 2020-11-27 15:02
    1. Right click project name and add a new swift file leave it as File.swift
    2. it will ask you to create a new bridging header accept
    3. Run the project again
    0 讨论(0)
  • 2020-11-27 15:02

    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-11-27 15:04

    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)
提交回复
热议问题