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

前端 未结 8 2144
离开以前
离开以前 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:31

    After a whole week fighting this issue, I developed a workaround using schemes and pre-actions.

    I have a configuration called "Beta", so Xcode can't compile SPM dependencies. I realised Xcode compile SPM dependencies as Swift modules and add the files in Build/Products/Release-iphoneos folder in DeriverData.

    So I created a scheme in Xcode and added this run script on build pre-actions:

    cp -f -R "${SYMROOT}/Release${EFFECTIVE_PLATFORM_NAME}/" "${SYMROOT}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/"
    

    This script run before the build process, coping files and modules generated by Xcode on default Release-iphoneos folder to configuration folder, Beta-iphoneos, in my case.

    After coping the content from Release-iphoneos to your $configuration$-iphoneos folder Xcode should correctly compile, build and run your project.

提交回复
热议问题