Reason: no suitable image found

IosIphoneXcodeDyld

Ios Problem Overview


dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /var/mobile/Containers/Bundle/Application/3FC2DC5C-A908-42C4-8508-1320E01E0D5B/Stylist.app/Stylist
  Reason: no suitable image found.  Did find:
	/private/var/mobile/Containers/Bundle/Application/3FC2DC5C-A908-42C4-8508-1320E01E0D5B/testapp.app/Frameworks/libswiftCore.dylib: mmap() errno=1 validating first page of '/private/var/mobile/Containers/Bundle/Application/3FC2DC5C-A908-42C4-8508-1320E01E0D5B/testapp.app/Frameworks/libswiftCore.dylib'
(lldb) 

I am getting this error when building on my iPhone. I am able to build on the simulator. I have redone all my provision files however I still can't build on my iPhone. My Xcode is like this

enter image description here

Is this a framework problem or a signing issue? This did not happen in Xcode 6. Thank you.

Ios Solutions


Solution 1 - Ios

I have this problem before for accidentally revoked my certificate. Then all my swift projects have this problem. There are two ways to solve this:

Click on Product → Clean (or CMD + Shift + K)

Or by manually cleaning the Xcode setting files:

rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Caches/com.apple.dt.Xcode

Solution 2 - Ios

I searched long on this issue. There are several reasons causes this issue.

If you are facing when you and Swift code/library in an Objectice C project you should try Solution 1-2-3

If you are facing this issue with a new a Swift project Solution 4 will fit you best.

Solution 1:

Restart Xcode, then computer and iPhone

Solution 2:

Go to project build settings and set Embedded Content Contains Swift Code flag to YES

Solution 3:

Go to project build settings and add @executable_path/Frameworks to Runpath Search Paths option

Solution 4:

If none of above works, this should. Apple seems to be ninja patched certificates as mentioned in AirSign's post

At InHouse certificates

Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, O=Company Name, C=FR

they added a new field named OU

Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, OU=269J2W3P2L, O=Company Name, C=FR

so you should just recreate certificate and provision

Solution 3 - Ios

Xcode->Product->Clean + Xcode Restart

After attempting many of the other mentioned solutions, to my eternal embarrassment, doing an Xcode->Product->Clean and restarting Xcode, did the trick.

Solution 4 - Ios

For me this issue was appearing due to the WWRD cert -- Mine was up to date but for some reason it was set to 'always trust' instead of 'use system default', which apparently makes a difference.

Solution 5 - Ios

If you accidentally reset your keychain, this can occur due to missing Apple certificates in the keychain. I followed the answer on this to solve my problem.

> I had the same issue and was able to fix by re-downloading the WWDR > (Apple Worldwide Developer Relations Certification Authority). > Download from here: http://developer.apple.com/certificationauthority/AppleWWDRCA.cer

Solution 6 - Ios

Removing the DerivedData did the trick for me.

Did it through Xcode -> Preferences -> Locations -> clicked the arrow behind the DerivedData path and removed the whole DerivedData folder in the Finder.

Solution 7 - Ios

It occurred on my side when building an app in the command line via xcodebuild and xcrun PackageApplication, signing the app with an enterprise profile. On our CI build servers, the certificate was set to "Always Trust" in the keychain (select certificate -> Get Info -> Trust -> "Use System Default" can be changed to "Always Trust"). I had to set it back to "Use System Default" in order to make this work. Initially we set this to "Always Trust" to work-around the keychain dialogs that appear after software updates and certificate updates.

Solution 8 - Ios

At the risk of sowing more confusion, I had this issue when updating to XC8.

None of these suggestions, nor from any other thread, solved it. What DID work, was removing EVERYTHING from the "Link Binary with Libraries" build phase, the "Target Dependencies" build phase, and the "Linked Frameworks and Libraries" General setting.

FYI, I'm using Carthage and had added $(PROJECT_DIR)/Carthage/Build/tvOS to the FRAMEWORK_SEARCH_PATHS build setting, so that my frameworks could be found.

FYI 2, this projects and the frameworks, are 100% swift and the frameworks are building DEFINES_MODULE = YES.

Solution 9 - Ios

  1. Remove the app from device
  2. Clean the project (CMD + SHift + K)
  3. Build/Run on device

Solution 10 - Ios

Cited from Technical Q&A QA1886:

Swift app crashes when trying to reference Swift library libswiftCore.dylib.

Q: What can I do about the libswiftCore.dylib loading error in my device's console that happens when I try to run my Swift language app?

A: To correct this problem, you will need to sign your app using code signing certificates with the Subject Organizational Unit (OU) set to your Team ID. All Enterprise and standard iOS developer certificates that are created after iOS 8 was released have the new Team ID field in the proper place to allow Swift language apps to run.

Usually this error appears in the device's console log with a message similar to one of the following: [....] [deny-mmap] mapped file has no team identifier and is not a platform binary: /private/var/mobile/Containers/Bundle/Application/5D8FB2F7-1083-4564-94B2-0CB7DC75C9D1/YourAppNameHere.app/Frameworks/libswiftCore.dylib

Dyld Error Message:
  Library not loaded: @rpath/libswiftCore.dylib

Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000120021088
Triggered by Thread: 0

Referenced from: /private/var/mobile/Containers/Bundle/Application/C3DCD586-2A40-4C7C-AA2B-64EDAE8339E2/TestApp.app/TestApp
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/C3DCD586-2A40-4C7C-AA2B-64EDAE8339E2/TestApp.app/Frameworks/libswiftCore.dylib: mmap() error 1 at address=0x1001D8000, size=0x00194000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/C3DCD586-2A40-4C7C-AA2B-64EDAE8339E2/TestApp.app/Frameworks/libswiftCore.dylib
Dyld Version: 353.5

The new certificates are needed when building an archive and packaging your app. Even if you have one of the new certificates, just resigning an existing swift app archive won’t work. If it was built with a pre-iOS 8 certificate, you will need to build another archive.

Important: Please use caution if you need to revoke and setup up a new Enterprise Distribution certificate. If you are an in-house Enterprise developer you will need to be careful that you do not revoke a distribution certificate that was used to sign an app any one of your Enterprise employees is still using as any apps that were signed with that enterprise distribution certificate will stop working immediately. The above only applies to Enterprise Distribution certificates. Development certs are safe to revoke for enterprise/standard iOS developers.

As the AirSign guys state the problem roots from the missing OU attribute in the subject field of the In-House certificate.

Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, OU=269J2W3P2L, O=Company Name, C=FR

I have an enterprise development certificate, creating a new one solved the issue.

Solution 11 - Ios

You may still get this issue after tried @Jieyi Hu Answer. may it's seems fixed but if it's comes again (possibly on xCode 9).

However, this workaround seems to work (applies to Cocoapods 1.5.x):

  1. clean your project

  2. close Xcode and delete DerivedData

  3. open Podfile in your project , and add this:

      installer.pods_project.build_configurations.each do |config|
        config.build_settings.delete('CODE_SIGNING_ALLOWED')
        config.build_settings.delete('CODE_SIGNING_REQUIRED')
      end
    end```
    
    
  4. pod update

Sources:

https://github.com/evgenyneu/Cosmos/issues/105

https://github.com/Skyscanner/SkyFloatingLabelTextField/issues/201#issuecomment-381915911

Thank you @Cédric

Solution 12 - Ios

you probably don't have the correct arch in that lib, you can do a

file /private/var/mobile/Containers/Bundle/Application/3FC2DC5C-A908-42C4-8508-1320E01E0D5B/testapp.app/Frameworks/libswiftCore.dylib

and it should show you the arch's that are in that library... I am not sure how you are linking, but it probably isn't the right way (if libswiftcore is a factory library, if it is some add on library then it probably isn't compiled correctly)

Solution 13 - Ios

I too had this issue, however nothing I tried above and in several other posts worked.. except for this.

For me, I changed the bundle identifier since we have a different bundle ID for distribution versus development.

My hardware is allowed on this provision and my team account is valid but it was throwing the above error on some other framework.

Turns out that I needed to completely remove the old version of the app completely from my phone. And not just deleting it the standard way.

Solution :

  1. Make sure the target phone is connected
  2. from within xcode menu click [Window>Devices]
  3. select the target device on the left side menu.
  4. On the right will be a list of applications within your device. Find the application that your trying to test and remove it.

Evidently on installing the same app under the same team under a different bundle ID, if your not starting completely from scratch, there are some references to frameworks that get muddied.

Hope this helps someone.

Solution 14 - Ios

I just cleaned the project and Clean Build Folder by alt Product menu

Solution 15 - Ios

Below steps worked out successfully.

  1. In the dynamic library install name had to be "@loader_path"

  2. In main project the Runpath Search Path has to be "@loader_path" and "@loader_path/Frameworks"

  3. From keychain used view-->show expired certificates and removed everything.

  4. Deleted the Distribution certificate and reinstalled.

  5. Downloaded developer.apple.com/certificationauthority/AppleWWDRCA.cer and installed.

Solution 16 - Ios

I recently faced this problem. I tried all possible solutions but nothing worked. At the end I just quit the Xcode , removed the certificates in keychain and installed everything fresh and restarted mac. Fortunately it worked like charm :)

Solution 17 - Ios

I had the same issue and was able to fix by re-downloading the WWDR (Apple Worldwide Developer Relations Certification Authority). Download from here:

and set to Always Trust in the keychain. Changing to Use System Default

it work for me,I hope this help you

Solution 18 - Ios

In my case ,the keychain is showing the certificate as untrusted ,to solve this problem I have set the trust options of certificate as "Always trust". Setting the certificate to "Always trust" was the main cause of the crash. I was not able to install the application into device. Solved this by setting trust option to "System defaults" instead of "Always trust" .It worked for me.

Solution 19 - Ios

You see the same symptoms if you are working in Xamarin Studio and you are referencing a portable library for which you need to do the PCL bait and switch trick for. This occurs if the referencing project is out of date with respect to the referenced library. I found that I had updated my common library to a newer framework, updated my packages but hadn't updated my iOS packages to match. Updating the packages solved this error for me.

Solution 20 - Ios

You can regenerate your certificate and restart your iPhone.

This work for me, I hope this help you.

Solution 21 - Ios

I solve the problem by check my local keychains.Keep login.keychain has the right certificate

Solution 22 - Ios

You need to set certificate (just certificate & not provisioning profile) for each and every dynamic framework you are linking(directly or indirectly) in your projectenter image description here

Solution 23 - Ios

In my case, after I delete all certification created by Xcode and downloaded. Let xcode 8.1 manage certification of app, It works well!!! Hope this can help someone.

Solution 24 - Ios

I have encountered this issue ONLY on the simulator. It seems to be related to some invalid Entitlements in our application, but the issue doesn't appear when we run on a device.

Solution 25 - Ios

I solved using these tricks.

Step 1:

Go to project build settings and add @executable_path/Frameworks to Runpath Search Paths option

Step 2:

Go to target build settings and add @executable_path/Frameworks to Runpath Search Paths option and Framework Search Paths.

enter image description here

Step 3:

Re-downloading the WWDR (Apple Worldwide Developer Relations Certification Authority), set to Use System Default as option.

Step 4:

Delete All derived Data using Terminal

rm -rf ~/Library/Developer/Xcode/DerivedData/*

Step 5:

Delete All Certificates and reinstalled it to Keychain. I enabled the Use System Default option.

Step 6:

Restart Xcode.

Solution 26 - Ios

faced same issue

  1. my developer certificate was expired so created new developer certificate and download
  2. clean and restart xcode this works for me

Solution 27 - Ios

I ran into this issue with XCode 9. Nothing of the above worked out. This did the trick for me:

Project > Build Settings > Swift Compiler - Search Path: Setting "Import Paths" to $(PROJECT_DIR) (recursive)

Solution 28 - Ios

This resolved my error-

Re-downloading the WWDR (Apple Worldwide Developer Relations Certification Authority), set to Use System Default as option.

Solution 29 - Ios

In my case, it was an issue with one of the pods I was using. I ended up removing that pod and placing the code from it into my project manually.

Solution 30 - Ios

For what it's worth, I hit a similar error in XCode 9.0.1. I tried uninstalling and reinstalling all my certs, but when I reinstalled, they seemed to remember the trust setting I had previously. What ended up working for me (it seems) was turning off the 'Always Trust' setting of the "Apple Worldwide Developer Relations Certification Authority" cert followed by a reboot. What a cryptic issue!

Solution 31 - Ios

enter image description here

I have a similar issue, which detail information as the first image.

My solution is that switch the certification always trust to use system defaults. just like: enter image description here

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSatsukiView Question on Stackoverflow
Solution 1 - IosJay HuView Answer on Stackoverflow
Solution 2 - Iosuser3432164View Answer on Stackoverflow
Solution 3 - IosSean VikorenView Answer on Stackoverflow
Solution 4 - IosWarblrView Answer on Stackoverflow
Solution 5 - Iosuser1742302View Answer on Stackoverflow
Solution 6 - IosNBoymannsView Answer on Stackoverflow
Solution 7 - IosJagveer SinghView Answer on Stackoverflow
Solution 8 - Iosdaimler250v8View Answer on Stackoverflow
Solution 9 - IosMaxim FirsoffView Answer on Stackoverflow
Solution 10 - IosAlvin GeorgeView Answer on Stackoverflow
Solution 11 - IosPranavan SPView Answer on Stackoverflow
Solution 12 - IosGrady PlayerView Answer on Stackoverflow
Solution 13 - IosChristopher Wade CantleyView Answer on Stackoverflow
Solution 14 - IosEdward AshakView Answer on Stackoverflow
Solution 15 - IosblackspearView Answer on Stackoverflow
Solution 16 - IosSTOPView Answer on Stackoverflow
Solution 17 - IosvoidxinView Answer on Stackoverflow
Solution 18 - IosRoshniView Answer on Stackoverflow
Solution 19 - IosThe SenatorView Answer on Stackoverflow
Solution 20 - IosJoffrey OuttierView Answer on Stackoverflow
Solution 21 - IosBill XieView Answer on Stackoverflow
Solution 22 - IosMayur KothawadeView Answer on Stackoverflow
Solution 23 - IosshujucnView Answer on Stackoverflow
Solution 24 - IosbkbeachlabsView Answer on Stackoverflow
Solution 25 - IosAlvin GeorgeView Answer on Stackoverflow
Solution 26 - IosMidhun NarayanView Answer on Stackoverflow
Solution 27 - IosggsView Answer on Stackoverflow
Solution 28 - IosDRPView Answer on Stackoverflow
Solution 29 - Iosradthemad4View Answer on Stackoverflow
Solution 30 - IosDunaView Answer on Stackoverflow
Solution 31 - IosLidia HanView Answer on Stackoverflow