问题
I've been using the simulator to test my app. Today I decided to test it using other devices in the simulator and to my surprise it crashes on startup on some devices, on others it works perfectly
My app builds an runs on :
- iPad Air
- resizable iPad
- iPhone 5S
- iPhone 6
- iPhone 6plus
- resizable iPhone
My App crashes on:
- iPad 2
- iPad Retina
- iPhone 4S
- iPhone 5
The Error I'm Getting is :
dyld: Library not loaded: @rpath/SwiftyJSON.framework/SwiftyJSON
Referenced from: /Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Demo Mobile
Reason: no suitable image found.
(lldb)
Sometimes I even get more information :
Referenced from: /Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Demo Mobile
Reason: no suitable image found. Did find:
/Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Frameworks/SwiftyJSON.framework/SwiftyJSON: mach-o, but wrong architecture
/Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Frameworks/SwiftyJSON.framework/SwiftyJSON: mach-o, but wrong architecture
/Users/data/Library/Developer/CoreSimulator/Devices/2ACCFF1F-D35F-444A-B709-2A41AC9CC7D2/data/Containers/Bundle/Application/DA7480F6-4032-4EB5-A51F-5D028088FFE1/Demo Mobile.app/Frameworks/SwiftyJSON.framework/SwiftyJSON: mach-o, but wrong architecture
(lldb)
I installed SwiftyJson via Cocoapods. My Podfile contains
platform :ios, '8.0'
use_frameworks!
pod 'SQLite.swift', git: 'https://github.com/stephencelis/SQLite.swift.git'
target 'thinx Mobile' do
pod 'SwiftyJSON', '~> 2.2.1'
end
I tried :
- clean & rebuild
- solutions 1, 2, 3 from dyld: Library not loaded: @rpath/libswift_stdlib_core.dylib
回答1:
After searching for almost a day I rebuild the project from scratch (new project, new podfile, new files but in each file copy-paste the source code from the original project) the app compiles now and runs perfectly on every simulator! No Errors.
But I still got a similar error (but different reason) on actual devices. I closed this question but there is a follow up question for that problem: dyld: Library not loaded: @rpath/SwiftyJSON.framework/SwiftyJSON.
回答2:
The question is related to iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta, that solved the issue and is a general answer for this kind of error I'd say
I experienced this at the moment of writing this post with Xcode 8.0
(Swift 3.0) and SwiftyJSON 3.1.3
来源:https://stackoverflow.com/questions/31830002/dyld-library-not-loaded-rpath-swiftyjson-framework-swiftyjson