Getting 'no such module' error when importing a Swift Package Manager dependency

前端 未结 8 2136
离开以前
离开以前 2021-01-30 14:37

I\'m running Xcode 11 Beta 4. I\'m using CocoaPods, and wanted to use one of my dependencies with Swift Package Manager as a static library instead of as a framework. On a fresh

相关标签:
8条回答
  • 2021-01-30 15:12

    Based on @AlexandreMorgado answer it seems like it is better to run this script in Build phases before Compile Sources. Then it works when archiving.

    if [ -d "${SYMROOT}/Release${EFFECTIVE_PLATFORM_NAME}/" ] && [ "${SYMROOT}/Release${EFFECTIVE_PLATFORM_NAME}/" != "${SYMROOT}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/" ] 
    then
      cp -f -R "${SYMROOT}/Release${EFFECTIVE_PLATFORM_NAME}/" "${SYMROOT}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/"
    fi
    
    0 讨论(0)
  • 2021-01-30 15:13

    After adding a library (FASwiftUI in my case) through Swift Package Manager I had to add it to

    Project Settings -> General -> My Target -> Frameworks, Libraries, and Embedded Content

    to be visible in the import statement.

    I did not add any scripts for it to work.

    0 讨论(0)
  • 2021-01-30 15:14

    I just ran into a similar problem and discovered that my schemes referenced old configurations, configurations that no longer existed. Once I updated them to the correct configurations the build succeeded.

    (I'm leaving this comment more than a year after the original post. It's possible that what I ran into is completely different from what was originally reported. Still, it took me quite a while to track the problem down, so I wanted to leave a note that might save others time.)

    0 讨论(0)
  • 2021-01-30 15:14

    In order to keep incremental builds working I had to specify the output files of "Fix SPM" build phase like so:

    0 讨论(0)
  • 2021-01-30 15:23

    Clearing the derived data solved the issue in my case. I have Microsoft Azure Devops CI Pipeline, to clear the derived data I have to edit the Xcode build task and in the "Actions" field add this command: clean.

    0 讨论(0)
  • 2021-01-30 15:23

    What worked for me: I removed my import WebMIDIKit line and added it again.

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