I open an existing project it contains many errors, this image explains more the issue:
I execute "pod install" but it doesn't solve the problem.
Change Swift Language Version to Swift 4 or higher, found in build settings.
move to the build setting of the project and change the project to swift4 and also move to the pods and every pod you have to change the Swift language version that is Swift 4enter image description here
The message describes all the things itself. You can not convert 3.x swift version into the latest one by using Xcode 10.2.1. You need to open this project in Xcode 10.1 first then convert it into the 4.x swift version.
Later you can open it in 10.2.1 version.
pod install will just install the pods with locked version of each library, of course it will not solve the issue.
Related
After updating iPhone to iOS 12.2 I encountered this error in Xcode 10.1:
“This iPhone is running iOS 12.2, which may not be supported by this
version of Xcode.”
So I have to update Xcode to latest version and after updating Xcode to 10.2, when I open the project, Xcode show another error that say:
Unsupported Swift Version
“MyProject” contains source code developed with Swift 3.x. This version of Xcode does not support building or migrating Swift 3.x
targets.
Use Xcode 10.1 to migrate the code to Swift 4.
Now I couldn't run the project correctly in neither Xcode 10.1 nor 10.2!
I think I have to update my code to Swift 5 to Xcode 10.2 be able to compile the code. Am I right?
But updating the whole project is overwhelming.
Is there any other way to resolve the problem?
The situation is neither dire nor daunting. All you really have to do is open the project with Xcode 10.1, mark the code as Swift 4, and close the project again. It would be good to migrate the code to Swift 4, though you don't have to; if you do, you certainly don't have to run it on a device — all you need to do is compile it as valid Swift 4. And the migrator will help you do that.
You will then be able to open the project in Xcode 10.2 and proceed however you like. Optimally you would then migrate again, to Swift 5, but you can postpone that step if you like.
But updating the whole project is overwhelming.
That is a matter of opinion, really. And after all, you got yourself into this situation by not migrating out of Swift 3 earlier (you have had literally years to do that, but you didn't), and by updating the system on your device.
Is there any other way to resolve the problem?
Not given your specifications. If you wish to run on this device that you have updated, you must update to Xcode 10.2, and you can do that only if you migrate out of Swift 3, which you can do with Xcode 10.1.
Open Xcode and change the project's Swift version to the latest (it'll say "unspecified").
Also update your project's Build Settings Library Search Paths to include this at the top:
$(SDKROOT)/usr/lib/swift
I have same issue while migrating code from Swift 3.x to Swift 4+.x :
Try to check two main things :
Target and project setting swift version should be 4.2 or swift 5 ( in case of XCode 10.2)
change build system.
I'm working in a specific Xcode project and deliberatly making errors in my code (like using undeclared variables), but Xcode doesnt seem to show any compile errors in my code.
It shows errors only when its build or clean.
Tried clean and build, cleaning derived data and restarted both Xcode and system, none of it works.
Using Xcode 8.2.1 (8C1002) and Swift 3
Besides the DerivedData folder, also try cleaning Xcode caches completely:
rm -rf $HOME/Library/Caches/com.apple.dt.Xcode/
I would recommend also killing the SourceKit process — always a source of issues these days! — but since you are already did a full reboot, so looks like you are good there.
If everything fails, you might consider upgrading to the latest Xcode, version 8.3. Just be aware that:
Xcode 8.3 no longer supports Swift 2.3. Please migrate your projects containing Swift 2.3 code to Swift 3 syntax by opening the project and choosing Edit > Convert > To Current Swift Syntax.
Project Settings, "Show all issues" fixed it for me.
For me, I had to first ensure all of my Xcode Targets had valid Signing & Capabilities like a development Team selected... then I was able to update all of my Targets to Swift 5 using the warning that was presented to me. Immediately after all of the targets were all updated to Swift 5 and the Provisioning was fixed, the red errors were flagged again!
I had the same problem using Xcode 13.3 with Swift version 5.5
Upgrading to Xcode version 14.1 (14B47b) which also upgrades Swift tools to version 5.7.1 fixed the problem.
Just updated to Xcode v8.1 and am trying to install a pod. However, once I import it, Xcode gives me an error saying Module Compiled with Swift 3.0 cannot be imported in Swift 3.0.1 and then a path to the module.
I have tried saying Use Legacy Swift Language Version however this does not solve the issue.
Any other ideas of what I can change to make this compile? I have a hard time believing a minor version change should cause this much trouble.
Thanks in advance for any help.
This happens almost every update. Try pod update in the terminal where the pods are located to get all your pods to the latest versions.
Just clean your project.
Select: Product -> Clean
Xcode version is 7.3.1
OSX 10.11.6
This link accurately describes the issues I'm having
https://github.com/marketplacer/keychain-swift/issues/37
Errors I'm getting make it clear that my system just isn't recognizing the Keychain.Swift file.
The above link suggests the file is in Swift 3.0, and I double checked that I am running Swift 2.2.
So I tried to install the older version of Keychain.Swift via cocoapods and it seems to update in my system, but I'm still experiencing the same build errors.
I placed "pod 'KeychainSwift', '~> 3.0'" inside the pod file in Xcode and ran "install pod" from terminal inside the project directory.
I tried shutting down Xcode and reopening, I tried running Product-> clean, but nothing seems to work.
The project is a work file that was pulled from github and seems to work on the original authors environment, but I have yet to successfully get my environment to work.
I appreciate any advice and suggestions. I am new to swift, cocoapods, and iOS development.
As i can see the current version of Keychain.Swift you are using is in Swift 3.0
It is giving you error of Date class which is introduced in Swift
3.0
Date Class Documentation Unfortunately Which is supported in ios 10+
Please follow the below steps to remove the previous version and switch to older version:
Remove this line "pod 'KeychainSwift', '~> 3.0'" from your pod and run install pod this will remove the current KeychainSwift pod.
Now add this line pod 'KeychainSwift', git: "https://github.com/marketplacer/keychain-swift.git", branch: "swift_2_3" Reference taken form this link this will install Swift 2.3 version of the file.
Enjoy Coading.
Turns out there are multiple libraries for utilizing the keychain. There is one called KeychainAccess and another one called Keychain-swift. One utilizes "import KeychainAccess" and the other "import KeychainSwift". I simply had the version for swift 3.0 when I'm using 2.2 (which we knew from the start, but still couldn't get it to work). The advice given by Harshal Bhavsar is accurate, but only if you are using "KeychainSwift". Otherwise, you want to roll back to an older version of "KeychainAccess" found here https://github.com/kishikawakatsumi/KeychainAccess/releases.
I downloaded the new xCode 8 beta. When i opened my old project(in swift 2.2), i clicked the convert to new swift syntax, and i clicked swift 3. The problem is that i use a framework downloaded with carthage (Kanna). I have tried to use the:
carthage update
but it doesn't work.
When i try to run the code on the new Xcode-beta, i get this error:
Module file was created by an older version of the compiler; rebuild 'Kanna' and try again:
Seems like i am very late to answer but there is update available for 'Kanna' framework supporting swift 3.0. You can add this to your podfile if you use CocoaPods
use_frameworks!
pod 'Kanna', '~> 2.0.0'
Or for Carthage you can install like
github "tid-kijyun/Kanna" ~> 2.0.0
First of all save a backup of your current project. Now!
Solution 1
Open your project with Xcode 7.3.1, it uses Swift 2.2 so it will signal you a bunch of errors. Since you know Swift 2.2 you should be able to fix the errors and make you project again compatible with Swift 2.2
Solution 2
In Xcode 8 beta you can choose the Swift versione (Swift 2.3 or Swift 3.0). Select Swift 2.3 (it's fully compatible with Swift 2.3 but does support the new iOS API). Then, again, fix the errors manually.
Solution 3
Open the library you are using and use Xcode 8 to upgrade that to Swift 3.0. This is a temporary solution until the developer of that library will provide the upgraded code
When you open your project with Xcode 8.0 for the first time, you will be prompted via the migration assistant to do a migration pass. The assistant can also be invoked manually from the menu
Edit -> Convert -> To Current Swift Syntax…
If you upgraded code e.g. 2.3 to 3.0 and now want downgrade to 2.3 you can use above. If any errors occur copy your code from last commit in your repository and it should work fine.