iosiphonexcodedyld

Reason: no suitable image found


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.


Solution

  • 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