Testing Xcode 7 UI with Cocoapods Errors on a Device

When I try to run my user interface tests on my device, I get an error message:

XCTRunner [1476: 104021] The "AppUITests" package could not be downloaded because it is damaged or the required resources are missing. 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. xctest / TrueMostUITests): The library is not loaded: @ rpath / UIColor_Hex_Swift.framework / UIColor_Hex_Swift Link from: /var/mobile/Containers/Bundle/Application/FAC2EFB2-92C6-4668-96A7-C77CC5UppAItsAppAItsAppAItsAppAItItItAppItItItItAppItItItItAppItItItItItItInItInInIt .xctest / AppUITests Reason: image not found)

In this case, this is "UIColor_Hex_Swift.framework", which is in my subcode. But it really doesn’t matter which framework I load from cocoapods. It will fail in every infrastructure.

I tried to change the swap file, clear it, delete the derived data, reinstall the containers and change the signature. No, I have no ideas.

Everything works fine if I use a simulator.

Here is my swap 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 
+6
source share
2 answers

In my case, I had to import UIKit and CoreData into one of my user interface tests. Then make a completely clean build (CMD-Shift-k).

 import XCTest import UIKit import CoreData class MyUITests: XCTestCase { 
+1
source

Just for reference, the solution that worked for me simply installs the Host Application manually in the target test

enter image description here

0
source

All Articles