When trying to run my UI Tests on my device I get the error:
XCTRunner[1476:104021] The bundle “AppUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. 2015-11-23 20:58:53.903 XCTRunner[1476:104021] (dlopen_preflight(/var/mobile/Containers/Bundle/Application/FAC2EFB2-92C6-4668-96A7-C77CC5C4AE87/AppUITests-Runner.app/PlugIns/AppUITests.xctest/TrueMostUITests): Library not loaded: @rpath/UIColor_Hex_Swift.framework/UIColor_Hex_Swift Referenced from: /var/mobile/Containers/Bundle/Application/FAC2EFB2-92C6-4668-96A7-C77CC5C4AE87/AppUITests-Runner.app/PlugIns/AppUITests.xctest/AppUITests Reason: image not found)
In this case it's "UIColor_Hex_Swift.framework", which is in my podfile. But it really doesn't matter which frameworks I load from cocoapods. It will fail on every framework.
I've tried changing pod file, cleaning, deleting derived data, re-installing pods and changing the signing. No I'm out of ideas.
Everything works fine if I'm using the simulator.
Here is my pod file:
platform :ios, '9.0'
workspace './AppWorkspace'
use_frameworks!
inhibit_all_warnings!
link_with 'App', 'AppTests', 'AppUITests'
target 'App', :exclusive => false do
pod 'SwiftyJSON', '~> 2.3.0'
pod 'MQTTKit', :git => 'https://github.com/mobile-web-messaging/MQTTKit.git'
pod 'PromiseKit', '~> 3.0.0'
pod 'UIColor_Hex_Swift',:git => 'https://github.com/yeahdongcn/UIColor-Hex-Swift.git', :branch => 'Swift-2.0'
pod 'OHHTTPStubs', '~> 4.3.0'
pod 'Alamofire', '~> 3.1.0'
end
def testing_pods()
# pod 'SwiftyJSON', '~> 2.3.0'
# pod 'MQTTKit', :git => 'https://github.com/mobile-web-messaging/MQTTKit.git'
# pod 'PromiseKit', '~> 3.0.0'
pod 'UIColor_Hex_Swift',:git => 'https://github.com/yeahdongcn/UIColor-Hex-Swift.git', :branch => 'Swift-2.0'
# pod 'OHHTTPStubs', '~> 4.3.0'
# pod 'Alamofire', '~> 3.1.0'
end
target 'AppTests', :exclusive => false do
testing_pods
end
target 'AppUITests', :exclusive => false do
testing_pods
end
In my case I had to import UIKit and CoreData in one of my UI Tests. Then make sure to do a completely clean build (CMD-Shift-k).
import XCTest
import UIKit
import CoreData
class MyUITests: XCTestCase {
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With