Xcode 7 is available, but I do not wish to migrate to Swift 2.0 just yet.
I have a problem with CococaPods. They seem to be compiled in Swift 2.0 or some new Xcode features and hence not working :)
As I use few pods that are almost abandoned and hardly maintained - it will take some time for me to migrate from them, or for them to migrate to Swift 2.0. How do I force Xcode 7 to compile them the old way ? :)
p.s. I did try changing Preferences > Locations > Command Line Tools to Xcode 6.4 (6E35b) but that does not seem to work.
Xcode 7 will only run swift 2.0. You should use either fall back to Xcode 6.4 or must upgrade to Swift 2.0.
If you decide to shift, you can integrate older libraries them directly rather than pods for now until they support swift 2.0. Even better if you fork them out, update them to Swift 2.0 and generate a pull request for admin to merge and until them use forked ones by providing url to your github like
pod 'Alamofire', :git => "https://github.com/yourgithubprofile/Alamofire.git"
Related
I have several projects developed in Xcode 10, but now Apple is saying (April 2020) that will not accept apps developed in Xcode 10, only Xcode 11. Is there any compatibility problem ? All my projects will compile properly in Xcode 11 ?
Is there any compatibility problem ? All my projects will compile properly in Xcode 11 ?
Try it and see? You don't really have a choice in the matter if Apple is going to stop accepting your Xcode 10 apps, so you might as well get started.
You can have multiple versions of Xcode installed at the same time. The best plan is to download Xcode from the developer site instead of the App Store, and rename each one with its version (e.g. Xcode-10.1, Xcode 11.4, etc.) so that they can all exist in your /Applications folder at the same time.
Xcode 11 will happily open your Xcode 10 projects, and everything should be fine. You may need to update some project settings to whatever Xcode 11 recommends, and your code will probably benefit from updates for the latest macOS or iOS versions.
What Apple will require is that apps be built with the latest versions of their platform's SDKs in order to be submitted and approved to be distributed through the App Store. They have extended the deadline for this to June 30, 2020 at the time I'm writing this (as you can see here).
This means that you need to make sure your project can be built using the latest SDK major versions. Make sure to open and build your projects using Xcode 11, which has the latests SDKs embedded in it. If your project fails to build, it can usually be because of 2 things:
The new SDKs API have changed and code that you wrote a while back might now be invalid. Go through the issues found by Xcode and update your code to make it work with the latest API.
The Swift language itself might have changed and code that you wrote a while back might now be invalid. These type of issues can be avoided by setting a specific Swift version to be used on your project in its build settings. Migrating your codebase to the latest Swift version (the one that's bundled with Xcode) might not be mandatory, but I'd recommend you do it if it involves just minor changes.
if after doing this, your project can be built, you should be good to go.
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.
None of the referenced answers works. Something new has happened with Xcode 10.2
This happens whether or not I use Swift 4.2 or 5.
It happens immediately with a brand new, unedited command-line tool.
All you need to do, is create a MacOS command-line tool, and hit "run."
You immediately get this error.
Nothing I have done so far has fixed it.
From the Swift 5 Release Notes for Xcode 10.2:
Swift 5 Runtime Support for Command Line Tools Package
Starting with Xcode 10.2, Swift command line tools require the Swift libraries in macOS. They’re included by default starting with macOS Mojave 10.14.4. In macOS Mojave 10.14.3 and earlier, there’s an optional package to provide these runtime support libraries for Swift command line tools that you can download from More Downloads for Apple Developers. If you installed the beta version of this package, replace it with the release version. This package is only needed for Swift command line tools, not for apps with graphical user interfaces.
Note that:
This is only necessary if you are still on macOS 10.14.3. As soon as macOS is upgraded to 10.14.4, the Swift runtime libraries are provided by the operating system, and command line tools created with Xcode 5 run without the need to install the “Swift 5 Runtime package.”
On macOS 10.14.3 with Xcode 10.2 you must download and install the latest “Swift 5 Runtime package.” An earlier package which you might have installed with an Xcode 10.2 beta release does not work.
Early versions of the Xcode 10.2 beta release notes recommended to add a user-defined setting SWIFT_FORCE_STATIC_LINK_STDLIB=YES as a workaround, that is no longer necessary.
This issue happened because I update XCode to 10.2 without updating the MacOS to the latest and the sdk that I used also not updated. Apparently these steps had solved my issues :
Update your MacOS the latest
for my case even updating all the required updates not solving the crash issue. In that case don't forget to check if your affected SDK/framework already rebuild from the latest XCode (10.2), since The problem went away after I rebuild the SDK with the latest XCode (10.2).
For my case, we used jenkins to release the app, if the cloud still using old xcode and os, the .ipa will still crash. Need macos and xcode on jenkins cloud to be also updated.
Because updating the cloud will affect everything (near the release date) so either I roll back the os and xcode, or I use the old sdk/framework (before rebuild state). But using the second option will make it crash on simulator but atleast no crash issue if release the app.
I updated my macOS as was suggested, but it did not help without the following change in the Package.swift:
- // swift-tools-version:4.2
+ // swift-tools-version:5.0
I just updated to Xcode 9 last week, and I've been looking for a way to get around this error:
Module compiled with Swift 3.1 cannot be imported in Swift 4.0
Each time a new version of Xcode is released that includes a new version of Swift, I have to wait for the RealmSwift project to be updated in order to build and run my project. I am aware that this has to do with Swift's ABI stability, but I also see others who seem to know how to get around this until a compatible version of Realm comes out. Currently, I am running 2.8.0, which was the current release as of last night. My dependency manager of choice is Carthage, but similar questions usually involve CocoaPods, which does not help me very much.
Can anyone offer some clear instructions for unfamiliar ones like me so I can keep working on my project now and when future versions come out? Thank you.
When using beta versions of Xcode which there are not prebuilt binaries for you need to pass --no-use-binaries to carthage bootstrap so that Carthage builds all of the dependencies from source.
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.