I use a combination of own and external pods in several projects. If I'm developing or updating a pod, I use a Podfile.local to avoid versioning/tagging every single change. The issue here, if that I must update Podfile to comment out every pod I'm using in Podfile.local to avoid errors.
Is there any way of telling cocoapods that should consider Podfile.local over Podfile when both files have the same pod to prevent this errors:
Analyzing dependencies [!] There are multiple dependencies with
different sources for Analytics in Podfile:
Analytics (HEAD)
Analytics (from ~/Documents/analytics_ios)
My Podfile:
source 'https://github.com/CocoaPods/Specs.git'
source 'http://gitlab.whatever.com/podfolder/cocoapods_ios.git'
platform :ios, '7.0'
# Allows per-dev overrides
local_podfile = "Podfile.local"
eval(File.open(local_podfile).read) if File.exist? local_podfile
pod 'Advertising/Dfp', :head
pod 'RSSParser', :head
pod 'DTCoreText'
pod "AFNetworking", "~> 2.0"
pod 'OurKeyboard', :head
pod 'VideoPlayer/GooglePrerollForAdMob', :head
pod 'Analytics', :head
pod 'AppVersioning', :head
My Podfile.local:
pod 'Analytics', :path => '~/Documents/analytics_ios'
The Podfile.local trick is no longer possible since CocoaPods 0.35 and was never officially supported.
See https://github.com/CocoaPods/CocoaPods/issues/2860
This same issue occurred when installing pod in Watch extension in existing application in Configuration :- Swift-3,Xcode-8.1 and Pod-version 1.0.1.
Existing Podfile With above error :
platform :ios, ‘10.0’ source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target "DemoApp" do
pod 'SwiftQRCode'
pod 'Alamofire'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3'
end
end
end
target 'WatchExtension' do
platform :watchos, '2.0'
pod 'Alamofire'
pod 'SwiftyJSON'
end
pod install
Solution:
Create the shared definition which can be shared between main app bundle and watch OS extension :-
Updated podfile : source 'https://github.com/CocoaPods/Specs.git'
#Create common defination to share the library between app and extension
def shared_pods
pod'Alamofire'
pod 'SwiftyJSON'
end
target "DemoApp" do
platform :ios, '10.0'
use_frameworks!
shared_pods
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3'
end
end
end
target 'WatchExtension' do
platform :watchos, '2.0'
use_frameworks!
shared_pods
end
So, Change in podfile has resolved above issue of "multiple dependencies with different sources....".
Need to update Library search path :-
My problem was that I had two same packages. One was deprecated other one was new just installed by me, but I didn't uninstall the deprecated package. So the new package was adding one dependency to my Podfile and the deprecated package was adding same the dependency, but from different source. I'd to uninstall the deprecated package and the error has gone.
Related
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?
I'm trying to use the new Stream iOS Chat SDK and am unable to get it to build after I install it via Cocoapods. The project was building with the other pods listed before we added StreamChat. I am using Xcode 10.2 (Does not work with 10.1), Swift 4.2, and Cocoapods version 1.7.4. We used the pod install command listed on Stream's website:
pod install --repo-update
Our Podfile looks like this:
platform :ios, '11.0'
inhibit_all_warnings!
target 'Project-iOS' do
use_frameworks!
# Pods for Project-iOS
pod 'ReachabilitySwift', '4.3.0'
pod 'SwiftKeychainWrapper', '3.2.0'
pod 'CropViewController'
pod 'StreamChat'
target 'Project-iOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'Project-iOSUITests' do
inherit! :search_paths
# Pods for testing
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
*Note that I tried this with and without the post_install bit at the end - but was having to manually change the pods to 4.2 since for many 5.0 isn't supported yet.
These are the errors I'm seeing when I try and build:
Edit: I also tried to get this running in a new blank project with just the StreamChat pod targeting iOS 11 (Basically just as the instructions on the site state for the ChatDemo) and ran into the same type of issues.
Related to your first question be sure to use Xcode 10.2 or later and Swift 5.
No need force pods to Swift 4.2. Try to remove these lines from your Podfile, then your project should compile without any errors:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
I just updated to Xcode 10 but can't make my project compile because of Realm.
When I use import RealmSwift I have this issue:
Module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2
compiler
I use Cocoapod and updated my pods. I have the last version of RealmSwift which is supposed to be Xcode 10 compatible. In the preferences the CLT is set to Xcode 10. In my project settings the language is set to Swift 4.
Using Realm (3.10.0)
Using RealmSwift (3.10.0)
I tried:
clean project and build folder
remove Realm from pods, build project then re-add
delete derived data
Here's my podfile:
source 'https://github.com/CocoaPods/Specs.git'
workspace 'ProjectName'
use_frameworks!
platform :ios, '10.0'
#deduplicate_targets: 'false'
inhibit_all_warnings!
def sharedPods
pod 'TwitterKit'
#pod 'TwitterCore'
pod 'Fabric'
pod 'Crashlytics'
pod 'RealmSwift'
end
target 'ProjectName' do
sharedPods
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
target 'ProjectNameTests' do
inherit! :search_paths
pod 'TwitterKit'
end
end
target 'ProjectNameExtension' do
sharedPods
end
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
I also tried removing the last part or changing with Swift 4.0 and even Swift 3.2.
I already saw similar questions on SOF but any reply worked for me.
Hi i am Install pod of Mapbox. I am getting following Error.
The Swift pod MapboxCoreNavigation depends upon MapboxMobileEvents, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.
This is my Pod File
source 'https://github.com/CocoaPods/Specs.git'
target ‘DailyWages’ do
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'MapboxNavigation'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.0'
end
end
end
Please Help.Any Help Would be Appreciated.
"use_modular_headers!" helped me.
Add it after this line: "target ‘DailyWages’ do"
I'm new to Unity iOS development and wanted to include a Google Play services in my Unity app. I've downloaded the Unity package (installed Cocoa, made sure my Pod file is set up correctly etc).
However, when I build my app I get GoogleSignIn/GIDSignIn.h file not found.
So far I've tried:
Installing 'Google/SignIn' using Cocoa (throws an invalid name
exception that)
Linking the GoogleSignIn bundle through Xcode linked
libraries (makes no difference)
Upgrading all packages (same as in Google/Signin) Adding
$(inherited) to linker flags (no change)
checking FrameWork Search path,Header Search path
Pods file:
platform :ios, '9.0'
target 'Unity-iPhone' do
pod 'GooglePlayGames', '~> 5.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end end end
I go through this links:
“GooglePlus/GooglePlus.h file not found” when trying to build my project
https://github.com/playgameservices/play-games-plugin-for-unity/issues/1526
https://github.com/playgameservices/play-games-plugin-for-unity/issues/1460
Change the pod file from below and again install the pod
platform :ios, '9.0'
target 'Unity-iPhone' do
pod 'GooglePlayGames', '~> 5.0'
pod 'Google/SignIn'
end