Issues with cocoapods after upgrading Xcode - swift

Updated my Xcode project and my IQKeyboardManager cocoapod was not working. I updated it and now I get this error:
Module file was created by an older version of the compiler; rebuild IQKeyboardManagerSwift
Any help on how to 'rebuild' a cocopod?

You can't rebuild the Cocoapods repo. You need to use the Use Legacy Swift Language Version to YES in your project.

Related

Error in resolving package dependency swiftUI project

Dependencies could not be resolved because root depends on 'googleappmeasurement' 9.0.0.
'googleappmeasurement' 9.0.0 cannot be used because 'googleappmeasurement' 9.0.0 depends on 'nanopb' 2.30908.0..<2.30909.0 and root depends on 'nanopb' 2.30909.0..<2.30910.0.
that is my error message, can anyone help?
I am using SDK version 8.9.1 and everything working fine, If you executed the Resolve Package Versions and still not working. you can try the command Reset Package Caches from Project navigator scroll down right click on Package Dependencies then choose the command. that will clear all caches for all installed packages then re-install them again. if that not working i suggest you to use version 8.9.1 till Firebase fix the issue.
I have discovered the problem has been answered here. It occurs when importing Firebase using Swift Package Manager and setting to track "master" instead of a specific release version.
Got same error and solved, check attached image, this most likely packages usage misconfiguration, as follows:
1-perhaps you are working on a branch with different Xcode version than the other developer who installed the package.
2-Perhaps some package is conflicted being used twice, by so some dependencies are duplicated.
Well to solve this you gotta try either to match the Xcode version used while installing the packages, or to remove the package that makes errors(like Firebase here), and try adding that package again your side.

Swift Version Conflict: this SDK is not supported by the compiler, Please select a toolchain which matches the SDK

I'm using xCode 13.1 with macOS 12.0.1 Monterey. I added KingFisher and removed it from my pod. but my project is not built anymore. I got this error for one of my local SDKs:
Failed to build module 'CbSdk';
this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.4
(swiftlang-1205.0.26.9 clang-1205.0.19.55)', while this compiler is 'Apple Swift version 5.5.1
(swiftlang-1300.0.31.4 clang-1300.0.29.6)'). Please select a toolchain which matches the SDK.
What I've done but didn't work:
pod deintegrate and pod install.
restart xCode with clearing cache and DerivedData.
checkout old branch and commit that worked before.
moving code to another macBook that worked before.
download, install and select toolchain 5.4 (odd errors appeared -> )
changing swift compiler language of my target and project to swift 4 (It says you are using swift 5.5.1 again!)
note that I didn't update xcode or swift!
Taken from this Twitter thread.
You need to set the BUILD_LIBRARY_FOR_DISTRIBUTION build setting on the framework target
https://www.swift.org/blog/library-evolution/
https://developer.apple.com/videos/play/wwdc2019/416/
I fetch the same problem when I try to update a library. My Xcode version was 13.2 with the swift version5.5.2. But the library I want to update required a swift version of 5.7.0. Using toolchains in Xcode might be the solution but I decided to update the Xcode version with the latest.
I update my Xcode to the latest version 14.1 and the issue is resolved. Automatically the swift version is found on the latest Xcode.

Cannot find interface declaration error Xcode 10.2 after Carthage update

I have updated the carthage after updated myxcode to 10.2 , And the Carthage framework class is not found alert I am getting .
Cannot find interface declaration for 'ChartMarkerImage', superclass
of 'BalloonMarker' ?
My project swift version was 4.0 still.
But the file is available in Carthage framework .
What was went wrong here ?
What i tried is
Set toolchain to SWIFT_4_2 but no luck.
Added #import <chart/chart.h> in pch file still getting error.
It's Carthage issue. The fixed release will soon available
UPD: Version 0.33.0 https://github.com/Carthage/Carthage/releases/tag/0.33.0
Update your carthage version to 0.33.0 from either of the below option
download pkg file from link
update carthage by homebrew
after updating use "carthage update --platform ios" command

How to update the version of compiled framework

I am using XCode 8.3 and I am trying to Run my project which is connected with link and now I have a XCode Error: Module compiled with Swift 3.0.2 cannot be imported in Swift 3.1
So my question is how to update the version of the framework?
I downloaded this framework from the link that I've posted above.
I think that you need to update CocoaPods to a newer version supports XCode 8 (CocoaPods 1.1.0 or newer):
sudo gem install cocoapods
Then do a pod update to fix your dependencies that are not linking:
pod update
Delete the DerivedData folder for your project and rebuild, the link error should be gone.

Module compiled with swift 3.0 cannot be imported in Swift 3.0.1

I upgraded Xcode to 8.1 GM and am now getting the below error for SwiftyJSON. Other imported frameworks seem to work. Is there a way to force this to work in Swift 3 until SwiftyJSON upgrades their framework? I used Carthage to import/update frameworks. I also tried changing Use Legacy Swift language version On and Off to no avail.
Module compiled with Swift 3.0 cannot be imported in Swift 3.0.1:
Modules/SwiftyJSON.swiftmodule/arm64.swiftmodule
SwiftyJson is being downloaded precompiled by carthage. The precompiled download is with Swift Version 3.0. That makes the compiler complain that the version is not correct. Using the following command:
carthage update --platform iOS --no-use-binaries
SwiftyJson (and all other frameworks within Carthage) will be compiled locally using the local version of Swift (3.0.1) and the compiler will not complain anymore.
Remove the app chache from DerivedData, and rebuild. the error may be fixed.
The DerivedData path like this:
~/Library/Developer/Xcode/DerivedData/
Make sure you've placed the new XCode 8.1 GM package in your Applications folder. We ran into this issue when one of us was running Carthage to update our dependencies, but had not replaced the XCode old 8.0 application in the applications folder (8.1 GM was running off the Desktop).
You want to make sure that when you run the following in terminal: xcrun swift -version that it returns Apple Swift version 3.0.1.
Updating default Xcode to new one on terminal worked for me.
Step 1 : Use following command to update Xcode version to latest on Terminal. Ref
sudo xcode-select -switch <path/to/>Xcode.app
Step 2 : Now try carthage update command
carthage update --platform iOS
Just to give the latest updates:
Carthage has released version 0.20 on Feb 27, 2017.
Carthage now only uses the pre-build binary if available pre-build binary is compatible.
That is being said, you no longer have to use: --no-use-binaries to avoid incompatible pre-build framework.
So make sure that you have carthage version greater than 0.20 and simply do:
carthage update --platform iOS
Just like #zirinisp said:
You can Using the following command:carthage update --platform iOS --no-use-binaries
Using the following command:xcrun swift -version to see the Swift version
Do this: Xcode->preferences->locations to clear the derived data and archives data, the most important to change the command line tools to "Xcode 8.1"
Using the following command:xcrun swift -version,you can see the swift version is 3.0.1
Set Use Legacy Swift Language Version = NO
I hope it will help you
Move the beta/GM version if the Xcode to /Applications folder and name it Xcode-beta
Check the output of:
xcrun swift --version
by running this command in terminal, its output should match with the swift version you want the app to compile, because Carthage uses output of this command, to determine the local Swift version.
Update Xcode version to latest on Terminal by running following command:
sudo xcode-select -s /Applications/Xcode-beta.app/
Build the libraries for iOS and prevents Carthage from downloading existing (yet incompatible) precompiled binaries, by running following command:
carthage update --platform iOS --no-use-binaries
Clean & Build
I had exactly the same issue with the library XCTest_Gherkin, what it worked for me was:
Product -> Scheme -> XCTest-Gherkin
Product -> Build
Hope it helps. I am using Cocoapods.
In Xcode Build Settings make sure your Framework Search Paths contain the appropriate Carthage Build folder:
$(inherited)
$(PROJECT_DIR)/Carthage/Build/iOS