I have multiple frameworks for different modules of my application:
I'm trying to create multiple targets, each one using a different configuration (development, stage, production). But if I use different configurations when I try to compile with using them, I got errors describing that I don't have some libraries that I actually have (I'm using CocoaPods, and after create the configurations I ran the pod install again, I also tried to deintegrate and install again).
The current configurations on the Application is:
Using Debug or Release I have no errors, but If I try to use a new configuration I get the errors. There's some extra configuration that must to be applied in this specific scenario, where I have multiple targets on my project?
PS: This is my Podfile:
platform :ios, '11.1'
use_frameworks!
workspace 'xxx-app-ios'
def materialdesign_pods
pod 'MaterialComponents/TextFields'
pod 'MaterialComponents/BottomSheet'
pod 'MaterialComponents/Ink'
pod 'MaterialComponents/ActivityIndicator'
pod 'MaterialComponents/Snackbar'
pod 'MaterialComponents/Buttons'
end
def presentation_pods
pod 'RxCocoa'
pod 'RxKeyboard'
pod 'RxDataSources'
pod 'RxSwift'
pod 'SnapKit'
pod 'lottie-ios'
materialdesign_pods
end
target 'PresentationKit' do
project 'Modules/PresentationKit/PresentationKit.project'
presentation_pods
end
def data_pods
pod 'Moya/RxSwift'
pod 'KeychainAccess'
pod 'RxSwift'
pod 'QueryKit'
end
target 'Data' do
project 'Modules/Data/Data.project'
data_pods
end
def domain_pods
pod 'RxDataSources'
pod 'SwiftJWT'
end
target 'Domain' do
project 'Modules/Domain/Domain.project'
domain_pods
end
def ui_components_pods
pod 'BEMCheckBox'
pod 'MBRadioCheckboxButton'
pod 'RxCocoa'
pod 'RxSwift'
pod 'lottie-ios'
I am using firebase for tracking crashes in my project and i am using the below pods in my project.
pod 'FirebaseCore', '6.6.4'
pod 'FirebaseMessaging', '4.3.0'
pod 'FirebaseAnalytics','6.3.1'
While archieving this project for placing the testflight build, i am getting duplication error below for google utilities :
Multiple commands produce '/Path/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework':
1) Target 'GoogleUtilities-00567490' has create directory command with output '/Path//IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
2) Target 'GoogleUtilities-54e75ca4' has create directory command with output '/Path//IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
When I checked my Pods settings in my build setting, I saw google utilities added twice in project. I have removed the one of the GoogleUtilities it's getting an error.
Note: I can able to run the build and I can't able to archive it. Is there any fix for achieving this build, without changing the legacy build system?
Because I have enabled the library distribution for my SDK, so when I made changes into legacy its throws an error.
Adding pod 'GoogleUtilities', '~> 7.7.0' to all the targets that use Firebase pods will make it work. In my case, this included 3 targets: iOS app, iMessage Extension and UnitTests.
No need to add this part explicitly:
def google_utilites
pod 'GoogleUtilities/AppDelegateSwizzler'
pod 'GoogleUtilities/Environment'
pod 'GoogleUtilities/Logger'
pod 'GoogleUtilities/MethodSwizzler'
pod 'GoogleUtilities/NSData+zlib'
pod 'GoogleUtilities/Network'
pod 'GoogleUtilities/Reachability'
pod 'GoogleUtilities/UserDefaults'
end
Update the Podfile to explicitly request all the needed GoogleUtilties subspecs. Examine the Podfile.lock to find the list.
There is a lot more detail at this CocoaPods issue.
This issue occurred to me when i added a new target to my project using very similar but not equal firebase dependencies, so GoogleUtilities was duplicated because my other target doesn't need as much dependencies from utilities as the main one so, basically (with the help of Paul Beusterien answer) went to the Pods project and look at both targets (GoogleUtilities-xxx) -> Build Phases -> Compile Sources and look at the differences in files added, basically in the new target was missing 'GoogleUtilities/UserDefaults' and 'GoogleUtilities/MethodSwizzler' but this can be different in any case, so i just did a compilation like this
platform :ios, '13.0'
def google_utilites
pod 'GoogleUtilities/AppDelegateSwizzler'
pod 'GoogleUtilities/Environment'
pod 'GoogleUtilities/Logger'
pod 'GoogleUtilities/MethodSwizzler'
pod 'GoogleUtilities/NSData+zlib'
pod 'GoogleUtilities/Network'
pod 'GoogleUtilities/Reachability'
pod 'GoogleUtilities/UserDefaults'
end
abstract_target 'AggregatedPodsTarget' do
use_frameworks!
google_utilites
pod 'FirebaseCore'
pod 'FirebaseAuth'
pod 'FirebaseFirestore'
pod 'FirebaseStorage'
pod 'FirebaseFunctions'
pod 'FirebaseAnalytics'
pod 'FirebaseMessaging'
pod 'Firebase/Crashlytics'
pod 'Google-Mobile-Ads-SDK'
target 'MainApp' do
end
target 'MainApp Dev' do
end
end
abstract_target 'ExtensionPodsTarget' do
use_frameworks!
google_utilites
pod 'FirebaseAuth'
pod 'FirebaseFunctions'
target 'Extension' do
end
target 'Extension Dev' do
end
end
after this i just did pod install and i went back to have only one GoogleUtilities Dependency
This worked for me, it's similar to this Bogdan's answer
Summarising steps
Add pod 'GoogleUtilities' so they don't clash from different targets
Clean install your pods (pod deintegrate and pod install)
Might need pod repo update.
Reopen xcode and archive, you would see single GoogleUtilities now
I saw this error when I tried archiving one of my projects where I had recently introduced another new target.
Going into the pod settings for this new target, I noticed that the iOS deployment version was different (14.4) from the iOS deployment version in the main Runner target (12.0) - something I had missed when I was initially configuring this new extension target.
The only difference between the iOS deployment versions I saw was that 14.4 had App Extensions enabled. Since that was something inconsequential to my project, I was happy matching the iOS deployment
versions for both my targets so they could refer to only one set of dependencies. After that, I just removed the duplicate pods for the version that I had removed. And I could archive again.
For each of your Targets, got to Build Settings -> check the iOS Deployment Target -> change the version so that they match.
For most circumstances, there is no reason why they should be different. But if for some reason you deem they should be different, checkout Paul Beusterien's answer and follow that.
We had the similar issue on Flutter project using firebase_core and firebase_analytics dependencies. Adding pod 'GoogleUtilities', '~> 7.7.0' in all the targets in the Podfile under ios folder.
target 'Runner' do
use_frameworks!
use_modular_headers!
pod 'GoogleUtilities', '7.7.0'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
target 'customnotificationext' do
use_frameworks!
pod 'GoogleUtilities', '7.7.0'
end
I am working on a project where I have added Firebase, Crashlytics etc using POD.
Now there is a requirement to create modules for each feature available in the app, so I created Modules for each Feature (Say Profile, Payment, Linking etc) & its working fine with main container app. Now My App looks like as below
Now I want to a use Framework(say Firebase) added Via POD in my module(Say Profile) but when I tried to import in a module I am getting
No such module 'Firebase'
Please suggest me how can add Framework added Via POD in any module.
Please also let me know If I have explained my question.
Below is my POD file
platform :ios, '8.0'
use_frameworks!
def mainPodPackage
pod 'Mapbox-iOS-SDK'
pod 'ZendeskSDK'
pod 'OneSignal'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'FacebookSDK'
end
target 'Production' do
mainPodPackage
end
target 'PreProd' do
mainPodPackage
end
target 'Dev' do
mainPodPackage
end
This is how you can install pod for multiple project workspace, edit your podfile as so, test target should have same project as it's target:
use_frameworks!
workspace 'Workspace_name'
project 'PjA.xcodeproj'
project 'path_to_PjB/PjB.xcodeproj'
target 'PjA' do
project 'PjA.xcodeproj'
...
end
target 'PjB' do
project 'path_to_PjB/PjB.xcodeproj'
...
end
I currently have 2 deployable frameworks. Same app, two faces: Client and Vendor.
Most of the data-model classes and some views are completely identical. So I've created another framework named "Common". I had no problem using Common as a dependency for Client and Vendor frameworks until Firebase and Crashlytics appeared.
I have some code that again, would be identical in both frameworks. So Common is the way I wanted to go. But, when using Cocoapods, there will be two definitions of those libraries, Xcode log says Class <<SomeFirebaseClass>> is implemented in both <<LONG CLIENT PATH>> and <<LONG COMMON PATH>>. One of the two will be used. Which one is undefined. and this issue occurs.
My Pod File:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
workspace 'Application'
use_frameworks!
# ignore all warnings from all pods
inhibit_all_warnings!
abstract_target 'CommonPods' do
pod 'ChameleonFramework/Swift'
pod 'Fabric'
pod 'Crashlytics'
pod 'Alamofire', '~> 4.5'
pod 'SwiftyJSON'
pod 'Firebase/Core'
pod 'Firebase/Auth'
target 'Attendant' do
project 'Attendant/Attendant'
end
target 'Client' do
project 'Client/Client'
end
end
I've found some issues in the CocoaPods's repository somehow related but no fix so far.
My question here is: How can I accomplish this? And if I can't, what is the best way to achieve something close to this?
I'm working with a mostly OBJc project,Tests are done with Cedar. I've started including swift and am having issues with cocoapod frameworks in my test target
Cocoapods version is 0.39.0 (upgrading to the beta gave me more issues so sticking with stable for now)
My podfile looks like this:
def test_pods
pod 'Cedar'
pod 'PivotalCoreKit/Development'
end
def app_pods
pod 'PivotalCoreKit'
pod 'JSONWebToken'
pod 'RealmSwift'
pod 'SwiftyJSON'
end
target 'App' do
use_frameworks!
app_pods
end
target 'AppTests' do
use_frameworks!
test_pods
end
The issue I'm having right now is when building for tests, it gives me "Can't find symbol" errors for all the pods in the main app target.
What I've done:
Added pods to both targets(produces error saying class exists twice)
Tried setting use frameworks only for app target
link_with, produces the same result as if adding them to both targets
I have a full swift app, that works just fine when setting the test pods to only the test target, so I'm assuming that because this is a hybrid code base, I'm seeing some issues.