5 Replies
      Latest reply on Oct 21, 2019 1:52 AM by eskimo
      skordumo Level 1 Level 1 (0 points)

        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?

        • Re: Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.1 compiler
          eskimo Apple Staff Apple Staff (12,095 points)

          Shouldn't Swift 5.1 module stability solved this issue?

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

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

          • Re: Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.1 compiler
            olivierfromnorth vancouver Level 1 Level 1 (0 points)

            I have enabled "Build Libraries for Distribution" and cleaned the build folder but i am still getting the "Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.1 compiler: /Users/oliviervincent/Documents/Spliqs/SpliqsAR/HelloWorld/AudioKit-iOS/AudioKit.framework/Modules/AudioKit.swiftmodule/arm64-apple-ios.swiftmodule" error.

            What am I missing please?

             

            (using Xcode 11.2 beta 2)

              • Re: Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.1 compiler
                eskimo Apple Staff Apple Staff (12,095 points)

                Hmmm, this is working for me.  Here’s what I did:

                1. I ran Xcode 11.1 (on 10.14.6, but I don’t think that’s relevant) and created a new framework from the macOS > Framework template.

                2. I added a new TFHello.swift file with the contents:

                  import Foundation
                  
                  
                  public enum TFHello {
                      public static func sayHello() {
                          NSLog("Hello Cruel World!")
                      }
                  }

                  .

                3. I set Build Libraries for Distribution (BUILD_LIBRARY_FOR_DISTRIBUTION) build setting.

                4. I built the framework.

                5. I control-clicked on the framework in the Project navigator and choose Show in Finder.

                6. Using the Finder, I copied that framework to my desktop.

                7. Back in Xcode 11.1, I closed the project and quit Xcode itself.

                8. I opened Xcode 11.2b2 and created a new app from the macOS > App target.

                9. I moved the framework from step 6 into that directory.

                10. I added that framework to the target.

                11. I changed the ViewController.viewDidLoad method to call it:

                  override func viewDidLoad() {
                      super.viewDidLoad()
                      TFHello.sayHello()
                  }

                  .

                12. I added a Copy Files build phase to copy it into the app’s Frameworks directory.

                13. I did a build and run.  The app built and, on launch, it logged:

                  2019-10-21 09:44:50.671009+0100 TestClient[42046:7455817] Hello Cruel World!

                  .

                I’m not sure why this isn’t working for you.  My advice is that you try to replicate my steps to check that things are working in general.  Then you can compare my process to the process you used in your real project to see what’s different.

                Share and Enjoy

                Quinn “The Eskimo!”
                Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                let myEmail = "eskimo" + "1" + "@apple.com"