13

I recently upgraded to Xcode 9 from 8.3.3.

Our project is written in Objective-C as are all the other frameworks we use. I have added a framework which is written in Swift (version 3.0). In Xcode 8, I am able to build and run the project without problem in simulator and on device. In Xcode 9 I am unable to run the project on simulator or device due to the error:

dyld: Library not loaded: @rpath/libswiftCore.dylib
Referenced from: .../libraryname
Reason: image not found

After downgrading, I was able to run the project again.

My configuration has:

ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
STRIP_SWIFT_SYMBOLS = NO;
SWIFT_VERSION = 3.0;
Cœur
  • 37,241
  • 25
  • 195
  • 267
joe muoio
  • 171
  • 1
  • 6

8 Answers8

0

After battling for several hours with this error and trying various solutions, my solution turned out to be different than others here so I'm adding it for others who may benefit.

I tried: - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES - LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks

No luck. Turned out the issue was more basic. My project has multiple build targets and somehow the setting for Host Application had gotten unset. enter image description here

Chuck Krutsinger
  • 2,830
  • 4
  • 28
  • 50
-1

The Swift framework has to be built with the same version of Swift as your project (in this case Swift 4 inherantly since you upgraded and are running through Xcode 9).

Rebuild and re-add/replace the framework with the new version and it should work.

Paul Popiel
  • 930
  • 11
  • 21
-1

Are you using Carthage and have multiple XCode_s on your machine? I had an issue recently when I ran carthage update --use-ssh --platform iOS while xcode8.3.3 was selected in the command line. Then included built frameworks into the build.

For it to work in XCode9 you will need to run switch command sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer for your Xcode.app and run carthage again.

Hope it helps.

Alex
  • 843
  • 8
  • 15
-1

Had the same problem. I'm using Xcode 9.2, Swift 4 and my device runs in iOS 11.1.

Solution:

I deleted Apple Worldwide Developer Relations Certificate Authority in Keychain Access and replace it with a new one (you can download certificate here)

After that, I have changed "Trust"(double-click the certificate) from "Always Trust" to "System Default".

-1

Try restarting Xcode. I tried everything else and this is what stopped the problem.

doodle
  • 47
  • 7
-1

It mainly occurs if your certificate trust settings is set to "Always Trust". Change it to "System Defaults" and recreate the build. This should solve the issue: https://egeek.me/2017/10/21/code-signing-blocked-mmap-on-ios-device/

-1

Just clean and built solve this problem. Tested in Xcode 9.2 and Swift 4

Cœur
  • 37,241
  • 25
  • 195
  • 267
xhinoda
  • 1,032
  • 1
  • 19
  • 26
-1

I faced the same problem (on Xcode 9.4.1) but couldn't solve it with any of the help. I faced a problem where Xcode kept on prompting me to use my keychain but couldn't complete the request—although I gave my password. The app built successfully and installed. However, it crashed upon running on the device immediately.

Here's what solved my issue.

  • Deleted my Certificate & public/private key pair
  • Created a new Certificate (via a CSR) and installed it on my computer
  • Linked the new certificate to the provisioning profile and installed the profile on Xcode
  • Cleaned the build and deleted the existing build on the device
  • Hurray!!!

Hope this helps someone who is searching through the planet!

Ruchira Randana
  • 4,021
  • 1
  • 27
  • 24