xcode: no such module 'Kingfisher' - swift

I want run my app on emulator
But I get this error:
no such module 'Kingfisher'
pod update, pod install, delete DerivedData folder, restart xcode, use xcworkspace, use xcodeproj and ... not solved my problem!
OS: 11.4
xcode: 12.4
My pod:
platform :ios, '11.0'
use_frameworks!
target 'Name' do
pod 'QuickBlox'
pod 'Quickblox-WebRTC'
pod 'Alamofire'
pod 'Kingfisher'
pod 'NVActivityIndicatorView/Extended'
pod 'PulsingHalo'
pod 'ImageScrollView'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
end

please use these commands in order in the project directory
1- pod deintegrate
2- rm podfile.lock
3- pod install
then clean project and build it should work

It happens to me sometimes.
first, clean build and then rebuild the project.
if there is no success try pod install, otherwise restart your device.

In my case Kingfisher worked with iOS and not with macOS. I used Xcodes package installer and not pod install. In order to fix my "no such module 'Kingfisher'" error for macOS:
I had to go to my TARGETS. (on the left side of General/Signing/etc)
Click on your macOS target.
Click "Build Phases" (2nd to last on the top row)
Go down to 'Link Binary with libraries.'
Click the '+' button and add the Kingfisher library.
If you have the error in your iOS version then add the library to that target instead. This won't fix everyone's issue, but no other solution I could find online worked and finally after clicking around I found this library was missing and it fixed my error, so I hope it helps someone.

Adding this to podfile helps me
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end

Related

Xcode Build Errors After Pod Update

I just did a pod update and tried to build my project; getting the following errors:
And here is my podfile:
# Uncomment the next line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'changelater' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for changelater
pod 'Firebase/Analytics'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'FirebaseUI/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Functions'
pod 'ProgressHUD'
pod 'Kingfisher', '~> 5.0'
pod 'Stripe', '15.0.1'
pod 'Alamofire'
pod 'GooglePlaces'
pod 'GoogleMaps'
pod 'GooglePlacesSearchController'
pod 'GooglePlacePicker'
end
Any idea why I am getting this error after update? and how I can fix it? I already did shift+command+K but it's not helping.
Cleaning your project is a good practice after updating your pod dependencies.
I had similar issues in the past after updating cocoapods.
Try
In Xcode menu: Product -> Clean build folder (shift+command+K)
Build your project again (command+B)
I simply had to update my xcode to the latest version and the errors disappeared.
It was just because I didnt have the latest xcode. So I had to update my xcode and update my podfile versions. Everything was fine after that!

How to fix cocoapod .modulemap file not found

When I try to build my project, I get a compile time error saying that a "Module map file" for my pod cannot be found and that I am missing a "SwiftShimes" module.
This is weird because all my modulemap files are where they should be when I install my pods.
I am using Xcode 10.2 and Cocoapods 1.6.1.
I have tried the following ->
deintegrating cocoapods from my project
cleaning the project
deleted ModuleCache and DerivedData
restarting my computer
This is the type of error I am getting ->
Module map file '/Users/kaunamohammed/Library/Developer/Xcode/DerivedData/OutNow-gxdxvzwmnijmrlajtbtyclkhrgqs/Build/Products/Debug-iphoneos/CodableFirebase/CodableFirebase.modulemap' not found
I expect my project to build properly but this is not the case and I am not sure what else to do.
This is what my Podfile looks like
platform :ios, '10.0'
workspace 'OutNow'
target 'OutNow' do
use_modular_headers!
#Pods for OutNow
pod 'Instabug'
pod 'SwiftMessages'
pod 'CodableFirebase'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Firestore'
pod 'Firebase/Messaging'
pod 'Firebase/DynamicLinks'
pod 'MarqueeLabel/Swift'
pod 'RxSwift', '4.4.2'
pod 'RxCocoa', '4.4.2'
pod 'Kingfisher', '5.3.1'
pod 'InstantSearchClient', '6.0'
pod 'CoordinatorLibrary', '1.0.5'
pod 'UIScrollView-InfiniteScroll', '1.1.0'
target 'OutNowTests' do
inherit! :search_paths
# Pods for testing
end
end
In case it helps anyone else, I was able to solve this issue a different way. I was accidentally opening up my .xcproject instead of my .xcworkspace. When I opened the correct file, the error went away.
I fixed this problem myself. I can tell you what I did. Not sure which steps did it exactly, but below are all steps:
Copy the contents of your Podfile somewhere safe
Run: pod cache clean --all
Remove "Podfile"-file from the dir.
Xcode: Product > Clean Build Folder
Run: pod init. A new "Podfile"-file is added to the dir
Start adding parts of your original Podfile to this file
Run: pod install
Try to build your project again
In my case, I think the row use_frameworks! in the "Podfile" did the trick.
Hope this help you guys out!
I had this issue only when I wanted to make an archive. On the other hand, debug worked fine. After a while I noticed that min iOS version was different between my Target, Project and Podfile min iOS version. After syncing them all to same value (iOS 11) Xcode offered me Validate Project Settings - Update to recommended settings option which I accepted and I was able to archive my project.
I spent a whole day trying to figure out how to solve this issue. I was facing issue in my project on M1 machine.
I enabled "Open using Rosetta" option in Xcode and worked for me.
Here is how you do that:
Open Finder --> Applications --> Right click "Xcode" --> Get Info --> check "Open using Rosetta"
I solve this issue by removing OTHER_SWIFT_FLAGS custom flag in Swift Compiler - Custom Flags
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS -Xcc -fmodule-map-file=\"${PODS_ROOT}/modulePath/moduleName.modulemap\"";
I faced this same issue but with Fastlane using gym build_app.
I ensured that min iOS version was synched between my Target, Project, and Podfile as mentioned by Josip B. This allowed me to archive my app using XCode but it still failed using Fastlane.
After lots of searching, it was able to resolve my issue by ensuring the IPHONEOS_DEPLOYMENT_TARGET version for each of my installed Pods inherited the version from my Podfile using this Podfile post-install script:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
Reference this post: https://stackoverflow.com/a/63489366/10211406
In case you are building on command line with xcodebuild, make sure you are using
xcodebuild -workspace ...
instead of just xcodebuild or
xcodebuild -project ...
I had this issue too, I'm not very familiar with XCode, but I opened the .xcodeworkspace file and then clicked build, which was successful!
It´ s a bit of a hack but try adding this in your podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end
make sure you add it to your bridge file, and Try to add this at the end of your podfile:
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end

Linker Issue Xcode Cocoapods

Installed three pods but for some reason can't get it to work
I tried reinstalling, updating, deintegrating but nothing does it.
I get the following errors. Tried creating the folders manually but the Linker Error remains always
Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Clima' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Clima
pod 'SwiftyJSON'
pod 'Alamofire'
pod 'SVProgressHUD'
end
The frameworks aren't being built. Just open {Yourproject}.xcworkspace generated after adding cocoapods instead of {Yourproject}.xcodeproj - that should help.

Xcode 9 fails to build Swift 4 project with pod

When attempting to build my Swift 4 project in Xcode 9 beta 2, some code signing error occurs after which the build of my app is discontinued.
The error that is shown in Xcode:
/usr/bin/codesign --force --sign - --preserve-metadata=identifier,entitlements '/Users/nickgaens/Library/Developer/Xcode/DerivedData/Emprova_Swift-bbvmoytlhlbqpueyftstselvwhdj/Build/Products/Debug-iphonesimulator/Emprova GPS Swift.app/Frameworks/Alamofire.framework'
/Users/nickgaens/Library/Developer/Xcode/DerivedData/Emprova_Swift-bbvmoytlhlbqpueyftstselvwhdj/Build/Products/Debug-iphonesimulator/Emprova GPS Swift.app/Frameworks/Alamofire.framework: No such file or directory
As you might notice, the --sign argument is followed by a single - character.
My setup:
Xcode 9 beta 2 (9M137d) with its bundled Swift 4-version
Cocoapods v1.2.1 with Podfile
platform :ios, '10.0'
target 'Emprova GPS Demo Swift' do
use_frameworks!
pod 'Alamofire', '~> 4.5.0'
pod 'AlamofireNetworkActivityIndicator', '~> 2.2.0'
pod 'KeyClip'
pod 'Localize-Swift', '~> 1.7.1'
pod 'FMDB'
end
target 'Emprova GPS Swift' do
use_frameworks!
pod 'Alamofire', '~> 4.5.0'
pod 'AlamofireNetworkActivityIndicator', '~> 2.2.0'
pod 'KeyClip'
pod 'Localize-Swift', '~> 1.7.1'
pod 'FMDB'
end
I didn't change a single letter of any of the added pods files.
I opened Pods.xcodeproj to check and double check Build Settings - Code Signing Identitiy of the Alamofire pod/target, but it is set to Don't Code Sign.
I already checked my Keychain Access app to see if the Apple Worldwide Developer Relations Certification Authority wasn't expired (it isn't) and is marked as trusted (it is).
I already emptied the DerivedData directory multiple times (~/Library/Developer/Xcode/DerivedData) and performed a Clean (both via Cmd+K and Cmd+Alt+Shift+K to no avail.
I already attempted to set the Xcode 'Command Line Tools' (Preferences - Locations - Command Line Tools) to both Xcode 8.3.3 (8E3004b) and Xcode 9.0 (9M137d) to no avail.
Completely ran out of ideas after having spent multiple hours searching for a solution. Does anyone have a clue why Xcode 9 no longer builds my project?
Also, link to my issue on Alamofires GitHub page, for the sake of completeness: #2183.
I found out what's wrong! Xcode continued using the .xcodeproj file to open my project when selecting it on the welcome screen, but Cocoapods requires the .xcworkspace file to be used! There's a visual distinction between both entries on Xcode's Welcome screen afterwards: difference between Xcode workspace and project on Welcome screen.
Opening the workspace shows two projects in Xcode's Project Navigator: one for my app and a second one named Pods, which embodies all installed pods. Building the app no longer shows weird build errors.

No such module JSQMessagesViewController

I'm trying to import JSQMessagesViewController:
import JSQMessagesViewController
And it gives me the error 'no such module'. I've seen many people with this problem on the web but I can't find the solution. Here's my podfile:
# Uncomment this line to define a global platform for your project
platform :ios, ‘9.2’
# Uncomment this line if you're using Swift
use_frameworks!
target ‘IXODES’ do
pod 'JSQMessagesViewController'
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Messaging'
end
I've tried cleaning the build, also pod deintegrate and then pod install and pod update. Nothing works and I can see the library in my project like the rest. Any help?
perhaps you tried to import the file and the file is missing by any chance,
a few things you can do.
you can clean the project from cocoapods and re-install cocoapod(this helped me onetime i got the same problem the file were missing) you can do that by
run this code on the terminal
[sudo] gem install cocoapods-deintegrate
once done
cd your file
and then run thispod deintegrate
then you're all set! and re install it
---- another solution ---
try these
1-Adding all of the .frameworks to the Projects Build Phases -> Link Binary With Libraries
2-Selecting each framework and building it. You can do this by selecting your project name next to the run arrow.
3-Cleaning the project and restarting my computer.
hope it helps