Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.1 compilerAsk Questions

 Posted on 10/19/2019

When building application in Xcode 11.2 beta (Swift 5.1.1) that uses framework build in Xcode 11.0 (Swift 5.1) I get an error that module compiled with 5.1 compiler cannot be imported by Swift 5.1.1 compiler. Shouldn't Swift 5.1 module stability solved this issue?

Share On: facebook gplus twitter
profile
Asked by Doug Stevenson on 10/19/2019 Score: 51 points
Add Comment:

Comments

2 Answers

0 Corrected Answers
Aproved Answers
0
Profile
Answered by hardik chaudhary on 10/21/2019 8:16:22 AM Score: 553 points

This problem is caused by the fact that you embed a pre-compiled framework. This can only be done if the swift compiler version that you use to compile your project is the same version that was used to compile that framework.

Hopefully, this restriction will be removed in future Swift / compiler versions... For more information refer to the chapter on Module Stability here: https://swift.org/blog/abi-stability-and-more

As already mentioned in one of the comments, the solution to this problem is to up- or downgrade to the appropriate Xcode version. (Or, if possible, recompile the framework with the desired compiler version)

Comments

Add Comment:
Aproved Answers
0
Profile
Answered by Jhon Walls on 10/19/2019 10:39:26 AM Score: 64 points

Yes, assuming you have enabled the Build Libraries for Distribution (BUILD_LIBRARY_FOR_DISTRIBUTION) build setting.

Comments

Add Comment:

Post Your Answers

Existing Members

Sign in to your account
Email Address
Password
New Member?
Sign up and complete profile
Full Name
Email Address
I have read and agree to the Terms of Service and Privacy Policy
Please subscribe me to the StoodQ newsletters
Guideline to answer a question:

Useful tips to submit your answer
Please read below guidelines before you submit your answer for question.

  • Read and understand question for which you are submitting your answer.
  • Try to avoid grammatical and spell mistake while answering.
  • Do not post any irrelevant information in your answer.
  • Explain your answer with example or any reference link to help who posted question.
  • If you find irrelevant question, please report it to support. Click here to contact support.
  • You agree to the privacy policy and terms of use to submit any contents.

Note: StoodQ is online developers community which helps developer for their difficulty, lets help them with your value contribution.