Swift Version 5, SwiftyJSON - swift

Build system information
error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'SwiftyJSON')
how can I deal with it?

SwiftyJSON v4.3.0 supports Swift 5. Check your Podfile to make sure you’re getting the latest release. You may need to update your Pods (with pod update) to make sure you’ve got the latest versions.
Also, you might consider retiring SwiftyJSON and using JSONEncoder/JSONDecoder instead. See Encoding and Decoding Custom Types or the Using JSON with Custom Types sample for more information.
If, on the other hand, you are not using Swift 5 yet, just configure your Podfile indicate that you want to use SwiftyJSON v4.2.0. E.g.
target 'MyApp' do
pod 'SwiftyJSON', '~> 4.2'
end

Either change the build target of your project to Swift 4.x or wait until the project gets support for Swift 5 (you can check that on the GitHub page)

I get this error too when i tried to pod lint or push.
error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2.
I have to stay on xcode 10.1 ans use cocoapods 1.5.3, but on a fresh install (new mac) I received the same error.
Here is my solution:
After comparing my 'gem list' with an other mac, I found that the gem xcodeproj was very high (1.12.0).
So, I installed a lower version required by cocoapods (1.5.3)
"sudo gem install xcodeproj -v 1.5.7"
and remove the never
"sudo gem uninstall xcodeproj -v 1.12.0"
Wrongs fine now, I cant lint and push my pods.

Related

Realm with Swift Error

I just created a new project and download and integrated the CocoaPods "RealmSwift". I get the following list of errors.
I have not added anything in my code. This is coming from Realm code. I am using Xcode 8 using Swift 3.0
Here is the Pod file:
If I say convert to Swift 3.0 then I get the following errors:
It seems the documentation for CocoaPods for RealmSwift may-be out of date when Xcode 8.1+ and Swift 3 is used. Step 3 is no more needed and you should skip it for this case.
i.e. you should now use (example):
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'RealmProjectAzam' do
use_frameworks!
pod 'RealmSwift'
end
Edit - addition information:
Please note, after the above question has been posted, there was some additional discussion incl. Realm and the result is that Realm (thanks #realm!) has adjusted its Swift documentation to better face the above issue. Please see the updated instructions for Cocoapods installation at realm.io
In short, to "solve" the above issue please:
Run pod repo update to make CocoaPods aware of the latest available Realm versions.

Alamofire not working well with swift 3

I have a project written by swift 2.
I updated to swift 3, I'm using Alamofire and swiftyjson
so I updated their by cocoapods and I fixed all my project issues,
after all that I got this error about Alamofire
The following binaries use incompatible versions of Swift:
also I have these warnings
this is my pod file
this what I see in terminal after pod update
Update all pods
Updating local specs repositories
CocoaPods 1.2.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1
Analyzing dependencies
Downloading dependencies
Using Alamofire (4.0.1)
Using DropDown (2)
Using SideMenu (2.0.5)
Using SwiftyJSON (3.1.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 4 dependencies from the Podfile and 4 total pods installed.
[!] The `ehtamiApp [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-ehtamiApp/Pods-ehtamiApp.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `ehtamiApp [Release]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-ehtamiApp/Pods-ehtamiApp.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
what is that mean? and how I can fix it?

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

Swift 3 CocoaPod does not pass lint

I’m upgrading a CocoaPod to Swift 3. It compiles and runs just fine, but pod lib lint fails with numerous compiler errors, because the linter tries to compile everything as Swift 2.3.
Attempts to set SWIFT_VERSION in the podspec or change “Use Legacy Swift Language Version” in my framework’s Xcode project do not solve the issue.
How do I make the pod linter use Swift 3?
It turns out CocoaPods now looks for a .swift-version file, as of 1.1.0.rc.2 (changelog). If the file contains 3.0, linting will work:
echo 3.0 > .swift-version
First you have to update cocoapods to 1.1.0.rc.2 by
[sudo] gem install cocoapods --pre
then as Paul Cantrell says, do
echo 3.0 > .swift-version
in the same dir where the pod spec is
I have this issue when develop SDK which is depending on socket.io-Client-Swift.
After type
echo 3.0 > .swift-version
still don't fix my problem.
However, I noticed pod lint use xcodebuild to test whether the framework is ready to be release without error.
Make sure you use Xcode8 to build pod lint. For some reason, I install both Xcode7 & Xcode8 and changed my xcodebuild path to xcode7, so the lint won't be pass when I want to make a framework with swift 3.
use the following code to make sure your xcode setting is right.
xcode-select -print-path
if the xcode-select path is not point to xcode8, you should using
xcode-select -switch <path>
set the xcode-select path to xcode8 which is usually in your Applications.
I know this was written for Swift 3, but you can do the same to update pods for 4.0:
echo 4.0 > .swift-version
This was done with version 1.3.1 of Cocoapods.

Bluemix Swift Mobile Client Access SDK when imported says no such module BMS Core and BMS Analytics show 35 errors due to which my build fails

As per the instructions given on Bluemix site; I installed the Swift SDK
pod use_frameworks!
pod 'BMSSecurity'
and it shows this on my terminal:
Then, when I built the project, I got 36 build errors.
First of which is "no such module as BMSCore" when I can see that framework imported in the pod and 35 errors related to BMSAnalytics, which is again framework imported.
These build errors are due to the incompatibility between two of the BMSSecurity dependencies (BMSCore and BMSAnalyticsAPI) and the version of Xcode you are using (7.2.1). The latest versions of these 2 frameworks only support Xcode 7.3 and higher, as explained in the BMSCore Github README. If you want to continue using Xcode 7.2, you can use BMSCore 1.0.3 instead.
So, there are 2 possible solutions here:
Upgrade Xcode to version 7.3
Add the following line to your Podfile: pod 'BMSCore', '~> 1.0.3'
Option 1 is recommended since only Xcode 7.3+ will be supported in future releases of BMSSecurity.
Are you opening FoodTracker.xcworkspace ?? please open .xcworkspace after pod install..