The bundle UITests couldn’t be loadedbecause it is damaged or missing necessary resources. Try reinstalling the bundle
Asked Answered
P

5

3

my pods are here

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

target 'myAPP' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for myAPP
  pod 'SwiftMessages'
  pod 'IQKeyboardManager'
  pod 'SwiftKeychainWrapper'
  pod 'Tabman'
  pod 'PagingMenuController'
  pod 'Kingfisher'
  pod 'Optik'
  pod 'KRPullLoader'
  pod 'AlamofireImage'
  pod 'Firebase/Core'
  pod 'Firebase/Database'
  pod 'Firebase/Messaging'
  pod 'Firebase/Auth'
  pod 'Firebase/Storage'
  pod 'TCPickerView'
  pod 'GoogleMaps'
  pod 'GooglePlaces'
  pod 'Whisper'
  pod 'Fabric'
  pod 'Crashlytics'
  pod 'SwiftyJSON'
  pod 'Alamofire'
  pod 'SwiftGridView'
  target 'myAPPUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

I am using swift 4, Xcode 10.1

  1. The bundle “myAPPUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. myAPPUITests-Runner[3649:845498]
  2. Library not loaded: @rpath/Alamofire.framework/Alamofire Referenced from: /var/containers/Bundle/Application/9948D3F3-0BC3-4E51-8611-934A8872BC25/myAPPUITests-
  3. Runner.app/PlugIns/myAPPUITests.xctest/myAPPUITests Reason: image not found)

I had try different solution but non of them work for me.

and here are my pods version enter image description here

Pathway answered 25/1, 2019 at 12:41 Comment(1)
Please add the list of installed libraries as text, not as image.Suppression
N
7

The bundle UITests couldn’t be loadedbecause it is damaged or missing necessary resources. Try reinstalling the bundle

Verify if all your targets are using the same iOS version in: Build Settings -> iOS Deployment Target

Namhoi answered 16/4, 2019 at 19:12 Comment(1)
This was the issue for me. I'd recommend checking this first before messing around with your podfile, otherwise you might be just telling your podfile to undo incorrect settings which you could fix without the podfile.Album
S
2

To install all dependencies, I added these lines to your Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if ['PagingMenuController', 'TCPickerView'].include? target.name
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '3.0'
      end
    end
  end
end

Then I removed use_frameworks! (see this link for more details) from your Podfile, run pod update and after that I was able to run tests.

For more details see this answer.

Suppression answered 26/1, 2019 at 15:48 Comment(1)
Thanks your answer help me out, how to figure my problem.Pathway
P
1

If you are using swift 3 or swift 4 and want to add UITest to your Project than don't forget following steps :

  1. Remove use_frameworks! from your pod file and update your pod file with pod versions of dependencies like below
  2. Use post_install to specify your swift version .
  3. Remove ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES Or set Them to No in both target app (myAPP & myAPUITests)
  4. Then run following commands :
  5. pod deintegrate , pod clean & pod install

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

    target 'myAPP' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks

          # Pods for myAPP
            pod 'SwiftMessages', '4.1.4'
            pod 'IQKeyboardManager', '6.1.1'
            pod 'SwiftKeychainWrapper', '3.0.1'
            pod 'Tabman', '1.9.1'
            pod 'PagingMenuController', '2.2.0'
            pod 'Kingfisher', '4.8.0'
            pod 'Optik', '0.3.0'
            pod 'KRPullLoader', '1.1.3'
            pod 'AlamofireImage', '3.3.1'
            pod 'Firebase/Core'
            pod 'Firebase/Database'
            pod 'Firebase/Messaging'
            pod 'Firebase/Auth'
            pod 'Firebase/Storage'
            pod 'TCPickerView', '0.2.5'
            pod 'GoogleMaps', '2.7.0'
            pod 'GooglePlaces', '2.7.0'
            pod 'Whisper', '6.0.2'
            pod 'Fabric', '1.7.9'
            pod 'Crashlytics', '3.10.5'
            pod 'SwiftyJSON', '4.1.0'
            #pod 'Alamofire', '4.7.3'
          pod 'SwiftGridView', '0.6.5'
          target 'myAPPUITests' do
            inherit! :search_paths
            # Pods for testing
          end
        end
    

add following at the end of your pod file

post_install do |installer|
    print "Setting the default SWIFT_VERSION to 4.0\n"
    installer.pods_project.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.0'
    end

installer.pods_project.targets.each do |target|
    if [].include? "#{target}"
        print "Setting #{target}'s SWIFT_VERSION to 4.2\n"
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '4.2'
        end
    else
        print "Setting #{target}'s SWIFT_VERSION to Undefined (Xcode will automatically resolve)\n"
        target.build_configurations.each do |config|
            config.build_settings.delete('SWIFT_VERSION')
            #config.build_settings['SWIFT_VERSION'] = '4.0'
        end
    end
end
end
Pathway answered 30/1, 2019 at 5:55 Comment(0)
H
1

Check the test target and check for iOS Deployment Target.

Select APPUITests -> Build Settings -> Deployment -> iOS Deployment Target

In my case, I was running in iPhone SE(iOS 11.1) and my test target iOS Deployment Target was 13.1. I changed the iOS Deployment Target to 11.0 and worked fine for me.

Henson answered 16/12, 2019 at 9:29 Comment(0)
T
1

My problem was solved adding the missing pods to the test target.

Looking similar to the below code:

target 'myAPP' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for myAPP
  pod 'SwiftMessages'
  pod 'IQKeyboardManager'

  target 'myAPPUITests' do
    inherit! :search_paths
    # Pods for testing
      pod 'SwiftMessages'
      pod 'IQKeyboardManager'

  end

end
Trawick answered 20/4, 2021 at 23:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.