我一直使用模拟器测试我的应用。今天我决定在模拟器上使用其他设备进行测试,令我惊讶的是,在某些设备上启动时会崩溃,而在其他设备上却可以完美运行。
我的应用程序可以构建和运行在:
- iPad Air
- 可调整大小的iPad
- iPhone 5S
- iPhone 6
- iPhone 6plus
- 可调整大小的iPhone
我的应用程序会在以下设备上崩溃:
- iPad 2
- iPad Retina
- iPhone 4S
- iPhone 5
我遇到的错误是:
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)
有时我甚至可以获得更多的信息:
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)
我通过Cocoapods安装了SwiftyJson。我的Podfile包含以下内容:
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
我尝试了:
- 清理和重建
- 从dyld: Library not loaded: @rpath/libswift_stdlib_core.dylib中使用解决方案1、2、3