Build Failed: No such module 'KIF' - ios

I've been having a sporadic issue when attempting to reference KIF in my Swift project.
My project stopped compiling after I did a "clean", and has been giving me the error: No such module 'KIF'
Here is my cocoapods file entry for KIF:
target 'MyProjectTests', :exclusive => true do
pod 'KIF', '~> 3.0', :configurations => ['Debug','QA']
end
(This is the recommended cocoapods config from KIF's readme.)
I can get it to compile again by changing the cocoapods entry from the above to:
pod 'KIF', '~> 3.0'
But the project crashes when attempting to run:
dyld: Library not loaded: #rpath/XCTest.framework/XCTest
Referenced from: /Users/albertbori/Library/Developer/CoreSimulator/Devices/29008343-5A97-47FB-B0E6-66D18A331BDA/data/Containers/Bundle/Application/C0E16F80-9A08-4228-96F7-8A24F08AB066/MyProject.app/Frameworks/KIF.framework/KIF
Reason: image not found
Then, if I switch it back to the original config, and do a pod install, testing with KIF works again...
How can I reference KIF correctly to ensure stable building and development with that framework?

After posting this issue on CocoaPods issue tracker, kylef helped me realize that I was inadvertently double-linking the pods.
Here is his pull request to resolve the issue on an example project I made.
In summary, the Podfile should look something like this, if you want to link both the root project and a test project, but conditionally add an extra pod to the test target:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'MBProgressHUD', '~> 0.8'
pod 'Locksmith'
target 'catch22Tests' do
pod 'KIF', '~> 3.0'
end
In this case, you DO NOT want to use: link_with 'catch22', 'catch22Tests' or it will link catch22Tests twice.

Related

1188 duplicate symbols for architecture arm64

this question has been asked a ton of times already but I'm still not able to understand how to really solve this...
I'm a beginner guy in iOS i never did iOS before and I do not understand how this things works, like armv64, armv7, armv64e, armv7s... There are a ton of configurations in the project file I don't understand and I don't even know if they are right or wrong...
My situation at the moment is I'm trying to publish an app to app store but I received an e-mail saying this
ITMS-90809: Deprecated API Usage - Apple will no longer accept submissions of new apps that use UIWebView as of April 30, 2020 and app updates that use UIWebView as of December 2020. Instead, use WKWebView for improved security and reliability. Learn more
Well to my understanding I need to stop using in my app UIWebView and start using WKWebView.
It's ok I did change my code to support WKWebView, but the problem is I still get the error because i have an external library referenced in my Pods.
The library is named AFNetworking and through some research on this post they recommend to change on my Podfile from:
pod 'AFNetworking', '~> 3.0'
to
pod 'AFNetworking', '~> 4.0'
Very well I did change it but it also forced me to changed my deployment target from:
platform :ios, '8.0'
to
platform :ios, '9.0'
Because of this error, "Specs satisfying the AFNetworking (~> 4.0) dependency were found, but they required a higher minimum deployment target."
After I did that i launched the file .xcworkspace and when I try to build I always get these errors of duplicate symbols, lipo, mach-o linker, etc... And honestly this is really confusing to me.
I did try the clean / build method, deintegrate and install pods again, but doesn't solve it, can you please help me ?
EDIT
My Podfile pods:
pod 'MagicalRecord', '~> 2.2'
pod 'MLPAutoCompleteTextField', '~> 1.5'
pod 'MBProgressHUD', '~> 1.1.0'
pod 'ECSlidingViewController', '~> 1.3'
pod 'Fabric', '~> 1.7'
pod 'Crashlytics', '~> 3.9'
pod 'AFNetworking', '~> 4.0'
pod 'Firebase/Messaging'
Image of errors:
Thanks for everyone that helped me trying to get this fixed.
I was able to fix it by doing these steps:
I removed some librarys I had referenced in my target, by going to project view -> target -> general and then here I removed some duplicated librarys I had.
After that I closed XCode and then went to my project folder in finder and deleted, pods folder, podfile.lock, .xcworkspace file.
I also added a line in my podfile use_frameworks!
Open terminal, go into project folder, and did the following commands:
pod deintegrate
pod install
After that opened the newly created .xcworkspace file, clean project and then build.
I think the problem I had is that I had these frameworks in my project targets and they were the same as in the pods so that's why I had the issue of duplicate symbols.

Firebase Crashlytics integration stucked at 'We'll be listening for your app to communicate with our servers.' iOS

I m trying to integrate Crashlytics, I have integrated earlier also. In sample project which I created to test it, in that it works fine. but in my actual project it stucks at step 3 "We'll be listening for your app to communicate with our servers."
I have followed all steps including run script
"${PODS_ROOT}/Fabric/run"
Also tried changing Debug information formate to DWARF with DSYM file. But nothing is working. This all is works if I integrate in sample app.
Bellow is the pod file list I m using in my project.
Can anyone please help me to solve this issue. I m stucked here from 2 days.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'TPKeyboardAvoidingSwift'
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'XLPagerTabStrip', '~> 9.0.0'
pod 'STPopup'
pod 'Alamofire'
pod 'STRatingControl'
pod 'Hero'
pod 'SDWebImage', '~> 5.0'
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
pod 'RealmSwift'
pod 'SDWebImage', '~> 5.0'
pod 'MaterialComponents/Snackbar'
pod 'GIFProgressHUD'
pod 'MBProgressHUD', '~> 1.2.0'
pod 'GPUImage'
pod 'Firebase/Messaging'
pod 'Firebase/Analytics'
pod 'Fabric'
pod 'Crashlytics'
target 'MyProjectTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyProjectUITests' do
inherit! :search_paths
# Pods for testing
end
end
I take it this is a migrated app since you are using Fabric dependencies. Your app either did not send a build and run event or it got stuck in an inactive state in the pipeline. If you are using Xcode to test this, I recommend launching your app, closing it, and then opening it from the actual virtual device dashboard. This will make sure that a build and run event is being properly sent to the endpoint.
However, if my above suggestion does not work, then you will need to write in to support(at)fabric(dot)io so they can ask for your AppDelegate init statements and info.plist to confirm what the issue might be.
I have faced the same issue and more research and tried then solved this issue.
Please follow the below steps to successfully configure Firebase Crashlytics.
Uninstall Crashlystics pods like pod 'Firebase/Crashlytics', pod 'Firebase/Analytics'
Remove run script from build settings
Remove Projects from Firebase consoles
Create new projects on firebase consoles
Configures setups like project name, Bundle ID, etc
make sure the bundle id in small laters even your Xcode camelcase for example your bundle id com.DemoFirebase.app then you need set in firebase configure com.demofirebase.app
Add pod 'Firebase/Analytics' in pod file
Execute script pod install in the command
Clean, Build and run the project it will communicate with firebase
Add FirebaseApp.configure() in appdelegate.swift
Clean, Build and run the project it will communicate with firebase
Add pods like pod 'Firebase/Crashlytics'
Add the new Run script in build settings
Clean, Build and run the project it will communicate with firebase
Enable Crashlystics on the Firebase dashboard
Test dummy crash using this code: https://firebase.google.com/docs/crashlytics/test-implementation?authuser=4
Congrats your Crashlystics successfully configures
I hope the above steps will help in your project and reduce more researching times
Thanks and Hits on the vote button
Happy Codings!

Module not found - cocoapods

I'm trying to pod install this library into my project's (lets say child xcodeproj) parent project (lets say Parent xcodeproj).
Child .xcodeproj has its own podfile where I have added RxSwift, RxCocoa, Realm and this GeoSwift library. Here is the cocoapods file as show below
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "9.0"
inhibit_all_warnings!
use_frameworks!
project 'LocationManager/LocationManager'
def pods
pod 'GEOSwift'
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
pod 'RealmSwift', '~> 3.0'
end
target 'LocationManager' do
pods
target 'LocationManagerTests' do
inherit! :search_paths
pod 'RxBlocking', '~> 4.0'
pod 'RxTest', '~> 4.0'
end
end
This LocationManager is installed into another XCode project as another podfile
def location_pods
pod 'GEOSwift'
pod 'LocationManager', :git => 'git#github.com:myrepo/locationmanager.git', :branch => 'users/me/add-geoswift'
end
target 'TestApp' do
location_pods
project 'TestApp.project'
end
When I try to compile the TestApp target, XCode throws an error as below
GeoSwift module is not found. This error is inside the Pods > LocationManager > MockLocationManager.swift The same module imported else where in that Pods > LocationManager works. Also import RxSwift and import RxCoca works. When I accessed Pods > Targets > LocationManager > Build Phases > Target Dependencies I see all the pods except GeoSwift
May I know how to fix this issue? Adding GeoSwift to this targetDependency doesn't compile either. When compiling LocationManager.xcworkspace as a separate entity it works perfectly fine. That module import GeoSwift doesn't throw any compilation error.
I had an issue similar to this.
Go into Pods:
Then click on "Build Settings", find the row titled "Swift Language Version", and try updating it to the latest (in my case, it was 4.1).
This worked for me! Hopefully it helps someone else out there too.
More info: Xcode 9 Swift Language Version (SWIFT_VERSION)
From what I know Cocoapods do not support sub-projects. I had an issue with this too and I promoted all my sub-projects as folders within the main project and put them under a different target. Now those targets can use Cocoapods too.

xcode library not found for -lAFNetworking

I have a ObjC app project with a UI Automation Swift target in it. By default the Run and Test build work successfully.
But I have to add a Cocoa Pod with a Swift framework for the UI Automation target... Podfile:
workspace 'BlahApp.xcworkspace'
platform :ios, '8.0'
project 'BlahApp/BlahApp.xcodeproj'
target 'BlahApp' do
pod 'Blahpod', '~> 2.1.6'
pod 'Mehpod', '~> 3.10.0'
end
target 'BlahAppUITests' do
use_frameworks!
platform :ios, '9.0'
pod 'autom', :git => 'https://blah.to.my.repo', :branch => 'master'
end
So I add this, do a pod install, Xcode clean, Xcode Run --> works, Xcode Test fails with:
ld: library not found for -lAFNetworking
AFNetworking is used in Blahpod.
Time wasted trying to get Xcode/Cocoapods to do what I want: 2 days
Somebody please help me here. tried other people's solution to the error message to no avail.
in build setting , search for Run Path
then add "#executable_path/Frameworks" and Remove All other Content Related to AFNetworking

ld: framework not found error in xcode 8

I am using xcode 8 for development and cocoapods 1.0.1 for frameworks. After installing frameworks, i couldn't able to build my project. I am getting "ld: framework not found" error. I am using following lines in pod file:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'Sample' do
use_frameworks!
pod 'MBProgressHUD', '~> 0.9'
pod 'TPKeyboardAvoiding', '~> 1.2'
pod 'SDWebImage', '~> 3.7'
pod 'UIActivityIndicator-for-SDWebImage'
pod 'UITextView+Placeholder', '~> 1.2'
pod 'Alamofire', '~> 4.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
After installing the frameworks, did you closed your project and opened the newly created workspace?
Once you start using CocoaPods to install framework, you must use the workspace as it includes your Sample project and the Pod project containing the frameworks.
In you project directory, make sure to open the .xcworkspace instead of .xcodeproj.
Edit:
If that is not the issue, go to your Sample target/General/Linked Framework and Librairies
You should only have one that should be name something like: Pods_Sample.framework
If you are only using cocoa pods to install frameworks it should be the only one there as it includes all the pods.
select your target -> General ->Embedded Binary , click + ,and add Alamofire.framework
try adding project 'APP_NAME.xcodeproj' to your podfile after use_frameworks! and do pod install again
if you receive warnings like below, after pod install
[!] The `APP_NAME [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-BasePods-APP_NAME/Pods-BasePods-APP_NAME.debug.xcconfig'. This can lead to problems with the CocoaPods installation
Go to Build Settings of your target and add $(inherited) to Framework Search Paths
I had this problem, and it happened a while after renaming my project.
It was using my Pod_Old_Project_Name as a framework.
I fixed this by going to Build Phases -> Link Binary With Libraries, and removed that framework.
There are two reasons this error occurs
I have faced the same issue, This comes only due to change in the
pod file or maybe the pod file may not exist, double check the pod
file and run the cmd pod install
After successfully installing the pod file still if you getting this
error please restart the Xcode, error goes away

Resources