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

Roman Podymov
  • 3,416
  • 3
  • 28
  • 49
Jibran SiddiQui
  • 240
  • 2
  • 14

5 Answers5

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

Narlei Moreira
  • 226
  • 2
  • 10
  • 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. – Bergasms May 28 '19 at 04:16
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.

Roman Podymov
  • 3,416
  • 3
  • 28
  • 49
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
Jibran SiddiQui
  • 240
  • 2
  • 14
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.

Jasmine John
  • 773
  • 7
  • 11
0

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
ggrana
  • 2,225
  • 2
  • 19
  • 28