Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITest bundle could not be loaded

Tags:

ios

swift

swift3

When i run the UITest in my phone it installs and runs as a separate app while giving the following error.

2017-07-27 10:44:33.892639+0700 XCTRunner[11886:3502890] Running tests... 2017-07-27 10:44:34.137927+0700 XCTRunner[11886:3502890] The bundle “...UITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. 2017-07-27 10:44:34.137999+0700 XCTRunner[11886:3502890] (dlopen_preflight(/var/containers/Bundle/Application/75C9B589-CCD4-480D-9E23-BA86878E8B37/...UITests-Runner.app/PlugIns/...UITests.xctest/...UITests): Library not loaded: @rpath/GoogleToolboxForMac.framework/GoogleToolboxForMac Referenced from: /var/containers/Bundle/Application/75C9B589-CCD4-480D-9E23-BA86878E8B37/...UITests-Runner.app/PlugIns/...UITests.xctest/...UITests Reason: image not found)

I am trying to find a solution for this problem more than a day.

I wanted to add UITests to my existing app and added UITest target to my app. I am using both carthage and cocoa-pod. I updated pod file and updated pod then i added frameworks to the UITest target which are installed by carthage.

This is my pod file

platform :ios, '9.0'
use_frameworks!

target 'ExampleApp' do
    pod 'Charts'
    pod 'ReachabilitySwift', '~> 3'
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'Google/Analytics'
    pod 'Firebase/Core'
    pod 'Firebase/Messaging'
end

target 'ExampleAppTests' do
    pod 'Charts'
    pod 'ReachabilitySwift', '~> 3'
    pod 'Fabric'
    pod 'Crashlytics'
end

target 'ExampleAppUITests' do
    pod 'Charts'
    pod 'ReachabilitySwift', '~> 3'
    pod 'Fabric'
    pod 'Crashlytics'
end

This is my cartfile

github "Alamofire/Alamofire" ~> 4.0
github "SwiftyJSON/SwiftyJSON" "3.0.0"
github "Friend-LGA/LGSideMenuController" ~> 1.0.0
github "TTTAttributedLabel/TTTAttributedLabel" ~> 1.13.4
github "MagicalPanda/MagicalRecord"

I could find a related question from stack overflow but unfortunately it was not helpful. can you please help me to add the UITest target to my project without a issue.

like image 270
Dimuth Avatar asked Jul 27 '17 05:07

Dimuth


1 Answers

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
use_frameworks!

def base_pods
    pod 'FBSDKCoreKit', '4.24.0'
    pod 'FBSDKLoginKit', '4.24.0'
    pod 'FBSDKShareKit', '4.15.0'
    pod 'FacebookCore', '0.2.0'
    pod 'FacebookLogin', '0.2.0'
    pod 'FacebookShare', '0.2.0'
end
target 'App' do
  base_pods
    target 'AppTests' do
        inherit! :search_paths
        # Pods for testing
    end

    target 'AppUITests' do
        inherit! :complete
        # Pods for UI testing
    end
end

the line inherit! :complete is key here

and in settings for the UITest target

enter image description here

NEXT:

  • clear derived data
  • pod deintegrate && pod install
like image 143
Helen Zhukova Avatar answered Nov 09 '22 03:11

Helen Zhukova