dyld: Library not loaded: #rpath/libswiftCore.dylib problem with new Xcode (10.2) - swift

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

Related

"Not Supported by this Version of Xcode” and After Update Xcode Raises "Unsupported Swift Version"

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.

Xcode SDK Version Issue

I'm having a bit of an issue with distributing an app via the latest version of Xcode (Version 10.1 (10B61)). Every time I try to upload it to the App Store via organizer, I get this error after uploading:
WARNING ITMS-90725: "SDK Version Issue. This app was built with the iOS 12.0 SDK. Starting March 2019, all iOS apps submitted to the App Store must be built with the iOS 12.1 SDK or later, included in Xcode 10.1 or later."
Previous answers to this question said that it was just a warning and that I should still be able to upload my app, but it is now March and I am still getting the error even on 10.1. iTunesConnect will not let me select these builds and I get emails about the validation failure.
Further details:
-The app is an iMessage extension, and uses exactly 1 framework from Carthage, which is up to date with the latest framework version and Carthage version.
-My project and Message extension targets Swift Language Version build setting is Swift 4.2.
-My deployment target is iOS 11.0, but the issue persists after selecting iOS 12.1.
-The app compiles and runs fine on my physical device running iOS 12.1.
-The issue persists after a build folder clean.
-The issue persists after reinstalling Xcode.
If anyone has any suggestions as to how I can verify my app is compiling with the latest SDK please let me know.
Whether the app runs on given iOS version, has no relevance to which SDK are you really using. The definitive SDK version used for building is found in the app's Info.plist.
after Archiving, Show the xcarchive in Finder.
right-click, Show Package Contents.
open Products/Applications/YourApp.app
right-click, Show Package Contents.
copy the Info.plist to some place where you can run terminal commands on it
/usr/libexec/PlistBuddy -c "print :DTSDKBuild" Info.plist
You would expect it to show "16B91" for SDK 12.1. If it's something else (SDK 12.0 would be "16A366"), here are some ideas:
inspect the Carthage dependency. Are you really building it locally or downloading a prebuilt binary? If in doubt, force local building with --no-use-binaries. Remove whole Carthage folder (Checkouts as well as Build) and start from scratch.
rm -rf ~/Library/Developer/Xcode/DerivedData instead of just "build folder clean"
Verify MacOS System Report section Software/Developer for the actual SDK versions that MacOS thinks that you have
xcode-select -p to verify that you are really using the Xcode instance that you would like to
If all looks correct on your side, fill Technical Support Incident. Report the exact rejected build which you uploaded already. That should speed up the support reaction.
I filled out a bug report with Apple because I was experiencing the exact same issue and none of the above solutions worked. They made a change on their backend and now everything is back to proper working order.
If you haven't tried in awhile, make another attempt and I'm betting that it'll work this time.
I was having the same problem. My app was compiled in Xcode 10.1 but I was still getting the SDK warning. I was able to resolve it by doing the following. I'm not sure if all these steps are necessary. I didn't try validating between steps.
I upgraded macOS to Mojave (10.14.3). I had been running High Sierra.
Delete Xcode from applications folder
Reinstall Xcode from the app store
Open my project and run Project->Clean Build folder
Archive and upload and no more warnings

Xcode not displaying compile errors

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.

Issues after installing upgraded XCode version

I installed XCode DP 4.5 recently - just to try out iOS 6.
I opened a project using it.
When I reopened using XCode 4.2.1 again, I started having storyboard data loss issue mentioned here.
I don't get this issue in 4.5 DP, but then I don't want to continue with XCode 45 DP. I am not sure if its valid to build my app with it. Also, it shows me "iPhoneOS 5.0 sdk not found warning" which is the base sdk I have set within my project.
What should I do to get rid of this issue?
Is it ok to continue using 4.5 DP?
If not, how can I safely go back to 4.2.1?
Is there any workaround in project to make, to regain my storyboard?
I also have storyboard backed up, but as soon as I import it into my project (within 4.2.1) - it complains it cannot open it. So I suspect it's due to a setting shared both by 45 DP and 4.2.1.
Please help...
Download the Golden Master for iOS 6 and use that for your development. As the GM version App may be compiled for distribution with it and Xcode 4.2.1 will become obsolete.
By default storyboards are set to be compatible with the current release of Xcode, and one previous release. You can choose to make them compatible with even older releases by modifying the development version pop up in the storyboard's file inspector.

Switch between Xcode 4.0.2 and 4.2

I am developing an app with Xcode 4.0.2 and iOS 4.3. Now I would like to upgrade to Xcode 4.2 and iOS 5 so that I could make my app ready when iOS 5 releases in October.
I am told by Apple's website that I should not submit apps that are built by Xcode 4.2 and should do it with the older Xcode 4.0.2, since the Xcode 4.2 and iOS 5 thing is still in beta.
But in the following few weeks I still need to have newer versions of my app submitted to App Store. So my question is,
If I upgrade my Xcode to 4.2, is it possible for me to switch back to Xcode 4.0.2?
If yes, how?
Thanks in advance!
You can simply install two versions of Xcode at the same time. During the installation it will let you choose the destination folder; you can pick another folder. For example, I use /Developer/Xcode (4.2). (However, if you did install 4.2 over 4.0.2, I don't think you would have a problem if you just ran the 4.0.2 installer again to downgrade.)
Taken from About Xcode.pdf (<Xcode>/About\ Xcode.pdf)
Installation
The Xcode installer will create the folder /Developer on the root of your boot partition, and place the Xcode developer tools and SDKs in this folder. If you have a previous version of Xcode you would like to preserve, you can copy the existing installation from /Developer to another folder to prevent having it updated automatically by the installer.
I would be cautious of this note (possible problems from incompatibility of tools???)
NOTE: The Xcode installer also installs system components and UNIX command line tools in a shared location on your Mac. Only one version of these components can exist on a computer at a time, and the last installed version replaces any previously installed set.
I always make sure I have a bootable drive with a decent working copy of xcode ready for releases in case I need to push a quick fix.
You can install 2 XCode in different folders.
Then you can switch back and forth.
Can I have multiple Xcode versions installed?