SPM in project pre Xcode 11 - 'No Such Module'

Hi,

I've a issue with integrating swift packages into projects that were created via e.g. xcode 10 (pre 11).

I see added library in 'Swift Package Dependencies' correctly, it's in 'Frameworks, Libraries and Embedded Content' section of target's settings as well as in 'Link Binary With Libraries' section of 'Build Phases'


If I create a new project then everything works smothly. A few things that I've already tried:

- Copy swift package manualy (by drag and drop) into the project

- Add package via file://LocalURL

- I've compared info.plist, build settings and schemes beteen old and new project (Maybe I've missed something, my guess is that the issue is in build settings but I can't find it)


The result is always the same, if I import SPM library in any file I get an error "No such module 'ExampleFramework'"


Any ideas? Thanks in advance for any help

Accepted Reply

Ok so after various tries I've created new project, added files from the old one and during this I've encountered at identical situation, it turns out that the issue is not in build settings but rather in configuration.

You cannot build SPM with different configuration than 'Debug' and as in most of my projects I have multiple configurations, that why I wasn't able to use SPM in them.

Unfortunately I couldn't find a way to change target configuration, nevertheless I'm closing this thread, I hope that my explanation above will hope someone with the same issue

Replies

This is very helpful.

This is STILL happening in Xcode 12 beta-3. Unbelievable.
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 about a year later. 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.)
Post not yet marked as solved Up vote reply of mul Down vote reply of mul
I had the same issue described above and I've been stuck for a few days on this. The comment of @mul did the trick. Thanks a bunch!
I can believe this issue is still there, using Xcode 12.4. I have this error too...
  • This solved the problem for me (using Xcode 12.5): "Edit scheme..." > Uncheck the "Parallelize Build" option under "Build Options".

    Now the "No such module..." error is gone and I can do Archiving. It's a good idea to reset the SPM cache, do a Clean Build and remove derived data before trying to archive again after toggling the option to Off.

Add a Comment