Xcode 10 UI Tests Reason: Image Not Found with Cocoapods - ios

I'm trying to run a UI Test in my app but as soon as the simulator launches I get:
The bundle “AppUITests” couldn't be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2018-10-05 11:04:59.772078-0500 AppUITests-Runner[53273:1645870] (dlopen_preflight(/Users/John/Library/Developer/Xcode/DerivedData/app-ios-client-ewtlrcqcxoeiaudgmthymuhcuxfz/Build/Products/Debug-iphonesimulator/AppUITests-Runner.app/PlugIns/AppUITests.xctest/AppUITests): Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib
Referenced from: /Users/John/Library/Developer/Xcode/DerivedData/app-ios-client-ewtlrcqcxoeiaudgmthymuhcuxfz/Build/Products/Debug-iphonesimulator/AppUITests-Runner.app/PlugIns/AppUITests.xctest/Frameworks/Alamofire.framework/Alamofire
Reason: image not found)
My UITest is the template created by Xcode 10, I'm using Cocoapods 1.5.3 and Swift 4.2
My project structure:
Workspace
Custom Framework (The Podfile is here)
App A (Here I'm running the UITests)
App B
My podfile looks like this:
platform :ios, '10.0'
inhibit_all_warnings!
use_frameworks!
target 'App Library' do
use_frameworks!
pod 'Intercom'
pod 'Spreedly'
pod 'Alamofire'
pod 'IGListKit'
pod 'CardIO'
pod 'SwiftKeychainWrapper'
pod 'OneTimePassword', :git => 'https://github.com/john/OneTimePassword.git', :branch => 'develop'
pod 'SnapKit'
pod 'DateToolsSwift'
pod 'BetterSegmentedControl'
pod 'SDWebImage'
pod 'SwiftLocation'
pod 'Nuke'
pod 'Instabug'
pod 'Mixpanel-swift'
target 'App LibraryTests' do
inherit! :search_paths
# Pods for testing
end
target 'App' do
project '../App/App'
inherit! :complete
use_frameworks!
pod 'FacebookCore'
pod 'FacebookLogin'
target 'AppTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'App Business' do
project '../App Business/App Business'
inherit! :complete
use_frameworks!
target 'App BusinessTests' do
inherit! :search_paths
# Pods for testing
end
target 'App BusinessUITests' do
inherit! :search_paths
# Pods for testing
end
end
end
# The UI Test target I'm trying to run
target 'AppUITests' do
inherit! :search_paths
use_frameworks!
# Pods for testing
project '../App/App'
pod 'Intercom'
pod 'Spreedly'
pod 'Alamofire'
pod 'IGListKit'
pod 'CardIO'
pod 'SwiftKeychainWrapper'
pod 'OneTimePassword', :git => 'https://github.com/john/OneTimePassword.git', :branch => 'develop'
pod 'SnapKit'
pod 'DateToolsSwift'
pod 'BetterSegmentedControl'
pod 'SDWebImage'
pod 'SwiftLocation'
pod 'Nuke'
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'Instabug'
pod 'Mixpanel-swift'
end
workspace '../app-ios-client'
I have tried putting the UI test target inside the target app with !inherit:complete and !inherit:search_paths, moving it outside like in the code posted above. I have also cleaned the build folders, deleted derived data and restarted Xcode and I still have this problem. I have also tried adding import UIKit and import Alamofire and nothing has worked. Between all this possible fixes I have run pod deintegrate followed by pod install. I think the problem may be related to the podfile being inside my custom framework but honestly I have no idea. Any ideas? Thank you!

My fix was similar to https://stackoverflow.com/a/54034832/883413 except I didn't bother with the post_install section.
Previously my podfile structure was similar to that in the question:
platform :ios, '10.0'
target 'AppName' do
use_frameworks!
pod 'PodName'
target 'AppNameTests' do
inherit! :search_paths
end
target 'AppNameUITests' do
inherit! :search_paths
end
end
Changing it to (the newer?) structure like this resolved the issue:
platform :ios, '10.0'
use_frameworks!
def all_pods
pod 'PodName'
end
target 'AppName' do
all_pods
end
target 'AppNameTests' do
inherit! :search_paths
all_pods
end
target 'AppNameUITests' do
inherit! :search_paths
all_pods
end

I fixed it by changing that target in my podfile to this:
target 'AppUITests' do
inherit! :search_paths
use_frameworks!
# Pods for testing
project '../App/App'
end

Try beside of adding inherit! :search_paths
also changing ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES in post_install
use_frameworks!
def shared_pods
pod 'SomePod'
end
target 'App_name' do
shared_pods
end
target 'App_nameTests' do
inherit! :search_paths
shared_pods
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
end
end
end

Related

ARC Semantic issue: No known class method for selector 'componentsWithLink:domain:'

I am stuck with an issue since past 5+ hours, I am working on a react native project of version 0.59.0, it is a 1.5 years old project and it is working fine on android, but when building it for iOS, I was facing many issues one of which was:
ld: library not found for -lFirebaseCore
So to make it work, I included arm64 in excluded architecture and my build started working on simulator but my IPA was not working on a real device, again after removing arm64 and resolving multiple issues, I am stuck with the following issue which is coming in RNFirebaseLinks.m file as :
ARC Semantic Issue Group: No known class method for selector 'componentsWithLink:domain:'
Also sharing my device specifications:
macos: Macbook pro(11.0.1), chip: Apple M1,
Xcode version: 12.4
PodFile content:
**# Uncomment the next line to define a global platform for your project**
platform :ios, '10.0'
target 'PropertiesPublisherNew' do
**# Uncomment the next line if you're using Swift or would like to use dynamic frameworks**
#use_frameworks!
**# Pods for PropertiesPublisherNew**
pod 'Firebase/Core', '6.3.0'
pod 'Firebase/Messaging'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Database'
**# pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'**
**# pod 'RNScreens', :path => '../node_modules/react-native-screens'**
**# pod 'react-native-netinfo', :path => '../node_modules/#react-native-community/netinfo'**
#pod 'react-native-webview', :path => '../node_modules/react-native-webview'
target 'PropertiesPublisherNewTests' do
inherit! :search_paths
**# Pods for testing**
end
end
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
target 'PropertiesPublisherNew-tvOS' do
**# Uncomment the next line if you're using Swift or would like to use dynamic frameworks**
**# use_frameworks!**
**# Pods for PropertiesPublisherNew-tvOS**
target 'PropertiesPublisherNew-tvOSTests' do
inherit! :search_paths
**# Pods for testing**
end
end
Can anyone please help me out with this?
Add pod 'Firebase/Core', '~> 5.15.0' in PodFile inside IOS Folder

No such module FirebaseStorage

I am working on an iOS project in swift 5 in Xcode 11.6 using cocoapods. Whenever I try to build it fails with the error message 'No Such Module FirebaseStorage'. I have tried deintegrating and installing several times. Below is the pod file I'm using. If I looking in the pods directory in the project folder, I can see a firebasestorage folder. I have also attached my header search path under the build settings for the workspace. header search path
Uncomment the next line to define a global platform for your project
platform :ios, '13.6'
#install! 'cocoapods', :disable_input_output_paths => true
target 'project' do
# use_modular_headers!
# Comment the next line if you don't want to use dynamic frameworks
# use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'MessageKit'
pod 'Firebase/Firestore'
pod 'Firebase/Storage'
pod 'SDWebImage'
end
# Pods for project
target 'projectTests' do
inherit! :search_paths
# Pods for testing
end
target 'projectUITests' do
# Pods for testing
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if Gem::Version.new('8.0') >
Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
end
end
end
end
I was wondering what might be causing this issue?

OBJC_META_CLASS Issue

Hi Team i am using following pod file in my single view application project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'projectbase' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for projectbase
target 'projectbaseTests' do
inherit! :search_paths
pod 'AFNetworking'
pod 'LGSideMenuController'
pod 'SDWebImage'
pod 'MBProgressHUD'
end
target 'projectbaseUITests' do
inherit! :search_paths
# Pods for testing
end
end
But As i am using "LGSideMenuController" in viewcontroller.h i am getting the Meta class error following is the code and screen shot of error
#import <UIKit/UIKit.h>
#import <LGSideMenuController.h>
#interface ViewController : LGSideMenuController
#end
Compilation with following line is OK
#import <LGSideMenuController.h>
But as i used
#interface ViewController : LGSideMenuController
error occurred
Can any one please help me to resolve this issue
Xcode version is 8.3.2
Please replace pod file with following code.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'projectbase' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'AFNetworking'
pod 'LGSideMenuController'
pod 'SDWebImage'
pod 'MBProgressHUD'
target 'projectbaseTests' do
inherit! :search_paths
end
target 'projectbaseUITests' do
inherit! :search_paths
# Pods for testing
end
end

I got error message Unable to find a target named `YOUR_APPLICATION_TARGET_NAME_HERE`, did find `FoodTracker` and `FoodTrackerTests`. how

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'FoodTracker' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for FoodTracker
target ‘FoodTrackerTests’ do
inherit! :search_paths
# Pods for testing
end
source 'https://github.com/CocoaPods/Specs.git'
target 'YOUR_APPLICATION_TARGET_NAME_HERE' do
pod 'GoogleMaps'
pod 'GooglePlaces'
end
end
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'FoodTracker' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
# Pods for FoodTracker
pod 'GoogleMaps'
pod 'GooglePlaces'
end
target ‘FoodTrackerTests’ do
inherit! :search_paths
# Pods for testing
end

iOS unit tests fail on CocoaPods Google Maps SDK

Since migrating our code base to Swift 3 using Xcode 8 we've been unable to get our unit tests to run. The app compiles and archives fine for the store, but when we try to run tests it fails to build complaining of:
framework not found GoogleMapsBase for architecture x86_64
I've checked our podfile and everything appears to be set correctly according to the latest documentation.
Edit: Podfile below
source 'https://github.com/CocoaPods/Specs.git'
target "Borked" do
platform :ios, '9.3'
use_frameworks!
pod 'GoogleMaps'
pod 'GoogleAnalytics'
target "Unit Tests" do
inherit! :search_paths
end
target "UI Tests" do
inherit! :search_paths
end
end
Something like this should work!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.3'
use_frameworks!
target 'MyApp' do
pod 'GoogleMaps'
pod 'GoogleAnalytics'
target "Unit Tests" do
inherit! :search_paths
end
target "UI Tests" do
inherit! :search_paths
end
end
or this
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.3'
use_frameworks!
target 'MyApp' do
target 'MyExtension' do
pod 'GoogleMaps'
pod 'GoogleAnalytics'
target "Unit Tests" do
inherit! :search_paths
end
target "UI Tests" do
inherit! :search_paths
end
end
end

Resources