简体   繁体   中英

Module compiled with Swift 4.0 cannot be imported in Swift 3.2.2: AudioKit

I have just updated xCode to the latest version, and am getting the error when trying to build.

"Module compiled with Swift 4.0 cannot be imported in Swift 3.2.2: /Users/james/Documents/MyApp/Pods/AudioKit/iOS/AudioKit.framework/Modules/AudioKit.swiftmodule/x86_64.swiftmodule"

It was working before I upgraded the latest xCode.

The error message is telling you that Xcode 9.1 is using Swift 3.2.2, while the Swift framework you're building against was built for Swift 4.0 (using Xcode 9.0). You need to update your frameworks to versions built for the version of Swift that you're using.

First If you update the Xcode the Xcode-> preferences-> LocationsTab and change the command line tolls Xcode version.. Now check here AudioKitReleases

pod 'AudioKit', '~> 4.0.3' 

AudioKit V4.0.3 for Xcode 9.1 Pod version according to your Swift language, and update your AudioKit pod by command pod update AudioKit

If you're using AudioKit with CocoaPods, you can run 'pod install' to pull the Swift 4/Xcode 9.1 ver of AK. Then clean (Shift + CMD + K), and clear the derived data. If still having issues, an Xcode restart should fix that.

Or, you can:

(1) Pull the latest AudioKit
(2) Re-compile the framework:

$ cd AudioKit/Frameworks
$ ./build_frameworks.sh

(3) Delete the Derived Data, Clean (Shift+CMD+K), and Restart Xcode

Best of luck,

Best way to get rid of this is, go to https://github.com/AudioKit/AudioKit/releases find the version compatible with the Xcode that you are using and change you pod file version. I was using Xcode 10.1 so I changed my file pod 'AudioKit', '4.5' it solved my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM