Getting dyld_fatal_error after updating to Xcode 6 beta 4 using swift

i0S Swift Issue

Question or problem with Swift language programming:

I just recently downloaded Xcode 6 beta 4, and my swift project compiles with no errors but before it gets to my code I get a dyld_fatal_error just above start in the call stack.

and a breakpoint in some assembly code with a nop instruction

The console error I get is

dyld: lazy symbol binding failed: Symbol not found: __TFSsa6C_ARGVGVSs13UnsafePointerGS_VSs4Int8__
  Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/Sudoku-dhrdonaeqzsgcvewndimxbbsltnc/Build/Products/Debug/Sudoku.app/Contents/MacOS/Sudoku
  Expected in: /Users/username/Library/Developer/Xcode/DerivedData/Sudoku-dhrdonaeqzsgcvewndimxbbsltnc/Build/Products/Debug/Sudoku.app/Contents/MacOS/../Frameworks/libswift_stdlib_core.dylib

dyld: Symbol not found: __TFSsa6C_ARGVGVSs13UnsafePointerGS_VSs4Int8__
  Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/Sudoku-dhrdonaeqzsgcvewndimxbbsltnc/Build/Products/Debug/Sudoku.app/Contents/MacOS/Sudoku
  Expected in: /Users/username/Library/Developer/Xcode/DerivedData/Sudoku-dhrdonaeqzsgcvewndimxbbsltnc/Build/Products/Debug/Sudoku.app/Contents/MacOS/../Frameworks/libswift_stdlib_core.dylib

Just so you know the project still compiles, and runs fine with Xcode 6 beta 3.

How to solve the problem:

Solution 1:

Most extremely weird problems like this can be solved with a Clean & Build (or perhaps relaunch Xcode). You might also consider deleting the relevant folders from ~/Library/Developer/Xcode/DerivedData.

Solution 2:

For sure this error is very unhelpful:

dyld`dyld_fatal_error:
->  0x1200ad088 <+0>: brk    #0x3

This of course occurs only on device, not the simulator. Another good reason to always test on a device.

Anyway, having had the same issue, a clean didn’t work for me. Deleting DerivedData didn’t help either. Also tried synchronising the Deployment Target versions. That didn’t seem make any difference but I did it anyway.

Solution was to add any dynamic frameworks to Embedded Binaries setting under Target -> General:

setting an embedded binary

Now I know that has been mentioned in other answers. However, if I can supplement by saying that any dependent dynamic frameworks must also be included.

So for example if you have a dynamic framework A that depends upon dynamic framework B, then it’s necessary to have A and B added to Embedded Binaries.

Note that if the dynamic framework A depends upon any static library or framework, you will almost certainly be forced to create A as an umbrella framework that includes the dependant binaries.

Other considerations that may or may not be important. However did personally for me result in success were;

  • paths of each dynamic library in the Inspector were set to “Relative
    to Group”. In the screen grab above the path of the embedded binary
    appears correct terminating with "build/Debug-iphoneos".

  • dynamic frameworks are in embedded binaries section. Static libs and
    static libs wrapped up as frameworks are in Linked Frameworks
    and Libraries. Nothing appears in both sections.

In setting this up XCode behaved strangely. The following proved successful:

  1. Add the dynamic framework to the embedded binaries.
  2. Find the new framework in XCode groups on the left and update the path to be
    “Relative to Group” as described previously.
  3. Delete the dynamic framework from embedded binaries.
  4. Add the dynamic framework to the embedded binaries again. The path should now appear correctly.
  5. Delete all references to the dynamic framework from the Linked Frameworks
    and Libraries section.

Solution 3:

I have just had this problem trying to link a custom iOS framework to my project, so for anyone out there who has this problem, it’s to do with the copy files build phase.

I think that this error results when a file cannot be found. So create a copy files build phase in the appropriate target in your project. Then add the file (in my case the custom framework) to this phase (if it’s a framework make sure to select the ‘Frameworks’ destination).

Solution 4:

Cleaning, restarting, deleting etc didn’t work for me.

I have a project containing another project. When I ran the project on iOS 7 and the contained project was accessed in code, the app stopped at the line below:

enter image description here

After many days, I saw that the deployment target for the container project was 7.0 (as can be seen below).

enter image description here

The contained project on the other hand, had a deployment target of 8.1 (as can be seen below).
enter image description here

Changing the deployment target of the contained project to 7.0 solved my problem!

The project was working fine on iOS 8 devices.

Solution 5:

I had this issue recently and the problem for me was that I had added a library from the same project which wasn’t listed in ‘Embedded Binaries’ from the ‘General’ section.

NOTE: If you add it in Embedded Binaries it will also add to the Linked Libraries section, possibly adding the same one twice.

Hope this helps!