Cocoapods pod file install not working "Unable to find a specification for `RealmSwift (~> 0.97)`" swift - swift

I'm attempting to install Realm for swift, expect terminal keeps giving me this error: Unable to find a specification for RealmSwift (~> 0.97). My pod file has been laid out exactly as they recommend. This is my pod file:
target 'AppName' do
use_frameworks!
pod 'RealmSwift', '~> 0.97'
end
target 'AppName Tests' do
use_frameworks!
pod 'RealmSwift', '~> 0.97'
end
target 'AppName UITests' do
end
target 'AppName Keyboatd' do
end
target 'AppName Keyboard' do
end

I just tried it with Realm Objective-C and it worked fine for me. That's strange.
It's possible that since the version is actually called '0.97.0', maybe it's necessary to include that extra '.0'.
Alternatively, is it completely necessary to include the version specifier in there? You can just leave it off, and you'll still get the latest version of Realm (0.97.1 was released a few days ago!)

Related

How to properly uninstall AdMob from iOS app

I have uninstalled the AdMob SDK by commenting out the lines in the Podfile. Then I run pod update. The AdMob SDK and the utilities are removed. However, I get framework not found FBLPromises error.
I have use_frameworks! uncommitted in the Podfile.
Even if I comment out use_frameworks! And run pod update I still get the error.
Here's my Podfile.
# Uncomment the next line to define a global platform for your project
platform :ios, '15.0'
target 'My Collection' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Auburn Collection
pod 'Gemini', '~> 1.4'
# pod 'Google-Mobile-Ads-SDK', '~> 8.9'
# pod 'GoogleUtilities', '~> 7.5'
pod 'TTSegmentedControl', '~> 0.4.9'
end
Two questions:
Do I need to use frameworks for the two remaining pods?
What am I doing wrong and what can I do to fix the error?
Thanks for the help in advance.
I did a search in my app for FBLPromises. It was still in Build Settings > Linking > Other Linked Flags. I had to manually delete it along with other AdMob frameworks. This solved the problem.
It also appears that Gemini uses frameworks so I do need them.

Error installing AFNetworkActivityLogger with AFNetworking 4.0 - Cocoapods

I get this message after submitting my app to App Store Connect.
ITMS-90809: Deprecated API Usage — Apple will stop accepting
submissions of apps that use UIWebView APIs When upload myApp
It tells me that my project is using WebView (deprecated library). I found the problem in AFNetworking library, after going to this page they report that version 4.0 this problem was corrected, so when I update my pod and run the pod install I receive the following error.
[!] CocoaPods could not find compatible versions for pod "AFNetworking/NSURLSession":
In snapshot (Podfile.lock):
AFNetworking/NSURLSession (= 4.0.1)
In Podfile:
AFNetworkActivityLogger (from `https://github.com/AFNetworking/AFNetworkActivityLogger.git`, branch `3.0.0`) was resolved to 3.0.0, which depends on
AFNetworking/NSURLSession (~> 3.0)
Specs satisfying the `AFNetworking/NSURLSession (= 4.0.1), AFNetworking/NSURLSession (~> 3.0)` dependency were found, but they required a higher minimum deployment target.
I really don't understand why or how to fix it, I already checked the AFNetworkActivityLogger Git project since here the cocoapods indicates that problem. On their page they mention that the problem is resolved in an update, however I cannot update this library so I got stuck at this point. I hope you help me, thanks in advance.
I share my pod so they can review it.
platform :ios, '10.3'
inhibit_all_warnings!
use_frameworks!
end
def common_pods
pod 'AFNetworking', '~> 4.0'
pod 'AFNetworkActivityLogger', :git => 'https://github.com/AFNetworking/AFNetworkActivityLogger.git', :branch => '3.0.0'
end
target 'PardosChicken' do
common_pods
end
target 'PardosChickenTests' do
pod 'OCMock'
pod 'Specta'
pod 'Expecta'
end
The PR you reference with the fix has not yet been merged. To point to the PR directly do:
pod 'AFNetworkActivityLogger', :git => 'https://github.com/ToshMeston/AFNetworkActivityLogger.git'

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.

CocoaPods Error When Adding New Libraries

I am making a chat application and before I started, I installed the google Firebase frameworks through cocoapods. I now realise that I would like to use another framework to handle image caching.
However, when I add the new line to the podfile and run pod install, I get an error.
Here is my podfile
And here is the error:
I think your add incomplete name of pod, Please correct it like this.
pod 'Kingfisher', '~> 3.0'
And then install pod againg
pod install
You are just missing an ' at the end of 3.0
Change the line to:
pod 'Kingfisher', '~> 3.0'
Then, try again and you should be good to go.