I am refactoring a monolithic codebase and want to split it into frameworks, my current situation is as follows:
App Project, depends on A, B and C
Framework A
Framework B, depends on A
Framework C, depends on A and B
All the above are in the same workspace, and each has his own pods:
App uses Firebase, Cryptoswift and RxSwift
Framework A uses Firebase and RxSwift
Framework B and C use RxSwift
Everything works fine, but at app launch, I see in the log that there are multiple (two) definitions for each framework, for example:
RxSwift is implemented in both 'app' and 'frameworka', which implementation will be used is undefined
(Tried both "Do no Embed" and "Embed & Sign")
Any ideas?
I am also fine switching to some other package manager if it helps solve the problem...
Thanks in advance!
My Podfile looks something like this:
platform :ios, '11.0'
use_frameworks!
workspace 'App'
project 'App/App'
project 'FrameworkA/FrameworkA'
project 'FrameworkB/FrameworkB'
project 'FrameworkC/FrameworkC'
target 'Appp' do
project 'App/App'
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'Firebase/RemoteConfig'
pod 'CryptoSwift'
pod 'RxSwift'
pod 'RxCocoa'
end
target 'FrameworkA' do
project 'FrameworkA/FrameworkA'
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Analytics'
pod 'Firebase/RemoteConfig'
pod 'RxSwift'
pod 'RxCocoa'
end
target 'FrameworkB' do
project 'FrameworkB/FrameworkB'
pod 'RxSwift'
pod 'RxCocoa'
end
target 'FrameworkC' do
project 'FrameworkC/FrameworkC'
pod 'RxSwift'
pod 'RxCocoa'
end
After some trial and error I did not find a solution to this.
I just ended up moving to Swift Package Manager, which does throw a compiler error (instead of just a line in the console log) when duplicated dependencies are found.
I then realized I could remove the dependencies and that's it.
Related
Every time I try to build I get the error 'No such module FirebaseUI'
Things I have tried:
Clearing derived data
running 'pod update' to make sure all dependencies are up to date
running my install as arch -x86_64 pod install
making sure I am running the app by opening .xcworkspace as opposed to .xcodeproj
Cleaning my build folder(Command+Shift+K)
Deleting my project and redownloading from Git
Adding the FirebaseUI Framework directly to my project
Changing the Scheme to FirebaseCore allows the project to build but the simulator does not open for testing, nor does it run on a physical device.
Running pod deintegrate && pod install, I noted that this command did mention that FirebaseUI was included and that the version was 11.03
Running xcode in Rosetta
I am running this project on a new MacBook Pro with the M1 chip. Previously, my project ran fine on the older intel chip. My Xcode version is 12.5.1, and my OS is 11.4
Here is my pod file:
# Uncomment the next line to define a global platform for your project
platform :ios, '12.0'
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
target 'Pikit' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Fixed Pod configuration
# Pods for Pikit
pod 'Firebase'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Functions'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Firebase/DynamicLinks'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Email'
pod 'FirebaseUI/Google'
pod 'FirebaseUI/OAuth' # Used for Sign in with Apple, Twitter, etc
# Other Podfiles
pod 'OnboardKit'
# Auto move screen for keyboard
pod 'SDWebImage'
pod 'PureLayout'
pod 'IQKeyboardManagerSwift'
pod 'Google-Mobile-Ads-SDK'
end
Edit
the previously selected answer was working for a while but after changing the version of an unrelated pod the application is showing the same issue.
FirebaseUI version 11 is now broken into submodules so you will need to import individual modules (e.g. import FirebaseAuthUI) rather than previously using just import FirebaseUI. Or instruct your Podfile to use an older version.
From FirebaseUI 11.0.0 release notes:
Breaking change: Broke monolithic FirebaseUI module into separate modules per feature. You'll need to update the imports in your project accordingly.
// FirebaseUI 10.x
import FirebaseUI
// FirebaseUI 11
import FirebaseAuthUI
import FirebaseDatabaseUI
// ...
I recommend you running the pod install command under the x86 architecture because I've seen that running this command native bring some problems, try:
arch -x86_64 pod install
I found a solution but I am going to keep this open as I am not sure it is a permanent solution/ not sure why it worked. This conflicts directly with one of the earlier answers. I removed all FirebaseUI pods besides the base one so that my pods related to fire base include only the following:
pod 'Firebase'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Functions'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Firebase/DynamicLinks'
pod 'FirebaseUI'
I am writing an iOS app, using CocoaPods 1.6.0 as my dependency manager. My project consists of a iOS app project (myapp-ui), as well as 3 iOS framework projects (myapp-common, myapp-model, and myapp-editor). I'm also leveraging Fabric.io for crash reporting and app metrics. My myapp-ui and myapp-model projects both make use of the Fabric and Crashlytics frameworks. My Pods file looks like this:
platform :ios, '11.0'
workspace 'MyApp.xcworkspace'
project 'myapp-ui/myapp-ui.xcodeproj'
project 'myapp-common/myapp-common.xcodeproj'
project 'myapp-model/myapp-model.xcodeproj'
project 'myapp-editor/myapp-editor.xcodeproj'
target 'myapp-ui' do
use_frameworks!
project 'myapp-ui/myapp-ui.xcodeproj'
# Pods for myapp-ui
pod 'SwiftyBeaver'
pod 'SwifterSwift'
pod 'Fabric'
pod 'Crashlytics'
pod 'KeychainSwift', '~> 13.0'
target 'myapp-uiTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'myapp-common' do
use_frameworks!
project 'myapp-common/myapp-common.xcodeproj'
# Pods for myapp-common
pod 'SwiftyBeaver'
pod 'SwifterSwift'
pod 'KeychainSwift', '~> 13.0'
end
target 'myapp-model' do
use_frameworks!
project 'myapp-model/myapp-model.xcodeproj'
# Pods for myapp-model
pod 'SwiftyBeaver'
pod 'SwifterSwift'
pod 'Fabric'
pod 'Crashlytics'
end
target 'myapp-editor' do
use_frameworks!
project 'myapp-editor/myapp-editor.xcodeproj'
# Pods for myapp-editor
end
The pods install just fine, and my app builds with no issue. However, when I run it I see a large number of errors in the console that look something like this:
objc[62607]: Class CLSInternalReport is implemented in both <SOME LOCATION>/Build/Products/Debug-iphonesimulator/myapp_model.framework/myapp_model (0x11252f960) and <SOME OTHER LOCATION>/myapp-ui.app/myapp-ui (0x10f2831e8). One of the two will be used. Which one is undefined.
objc[62607]: Class Crashlytics is implemented in both <SOME LOCATION>/Products/Debug-iphonesimulator/myapp_model.framework/myapp_model (0x11252f9b0) and <SOME OTHER LOCATION>/myapp-ui.app/myapp-ui (0x10f283238). One of the two will be used. Which one is undefined.
objc[62607]: Class CLSFileManager is implemented in both <SOME LOCATION>/Build/Products/Debug-iphonesimulator/myapp_model.framework/myapp_model (0x11252fa00) and <SOME OTHER LOCATION>/myapp-ui.app/myapp-ui (0x10f283288). One of the two will be used. Which one is undefined.
objc[62607]: Class CLSAlert is implemented in both <SOME LOCATION>/Build/Products/Debug-iphonesimulator/myapp_model.framework/myapp_model (0x11252fa78) and <SOME OTHER LOCATION>/myapp-ui.app/myapp-ui (0x10f283300). One of the two will be used. Which one is undefined.
Is there a way to address these warnings? I've tried removing them from myapp-ui thinking that myapp-ui makes use of myapp-model (and would therefore inherit the dependency) but that didn't work. I'm at a loss as to how to address this. Thoughts?
I was getting the same warnings you're seeing and took me a while to find a fix. Turns out this happens when you have a dependency that comes pre-compiled, like Fabric and Crashlytics. I think it's because they are copied twice.
What I did was to add those pods only to the app target. My Podfile ended up looking somewhat like this
def pods
pod 'CGMath'
...
end
def app
pod 'Crashlytics'
pod 'Fabric'
end
target 'FrameworkTarget' do
pods
end
target 'AppTarget' do
pods
app
end
We are trying to integrate FireBase SDK in Unity Project for iOS platform. For testing, we imported FireBaseAnalytic.unitypackage in an empty project, and put GoogleService-Info.plist on Assets folder.
Once we export XCode project from Unity and build in XCode we are getting few errors about missing few classes from:
we also tried to install Cocoapods file and place Podfile in XCode Project. Cocoapod file contains information as below:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Unity-iPhone' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Unity-iPhone
target 'Unity-iPhone Tests' do
inherit! :search_paths
# Pods for testing
pod 'Firebase/AdMob'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Invites'
pod 'Firebase/Messaging'
pod 'Firebase/Performance'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
end
end
even these all changes do not help to build test project even just with Firebase Analytic.
I am using Xcode 8.2.1, Swift 3, and IOS 10.2 (for iphone simulator). I am trying to follow this tutorial https://www.raywenderlich.com/139322/firebase-tutorial-getting-started-2
I have not gotten to the Firebase stuff. Right now I am just trying to build and compile the starter code.
The starter Podfile looks like this:
inhibit_all_warnings!
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
When I run pod install, I get
Re-creating CocoaPods due to major version update.
Analyzing dependencies
[!] The dependency `Firebase/Core` is not used in any concrete target.
The dependency `Firebase/Database` is not used in any concrete target.
The dependency `Firebase/Auth` is not used in any concrete target.
What should I do to fix this?
this might works for you
target "TARGET_NAME" do
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
end
It's caused by not specifying the target. You have to add the target "your target name" in Podfile.
Here is my podfile for Firebase:
platform :ios, '7.0'
pod 'Firebase/Database'
pod 'FirebaseUI'
Firebase for iOS is an Objective-C framework which recommends integration using Cocoapods. Here's how I'm trying to set it up:
I am running Xcode 8b6 on OS X 10.11.6. The app is being built with the iOS 10 SDK, targeting iOS 9.
MyApp is the regular (Swift) iOS app I want to use.
MyFramework is an embedded dynamic framework with the app, q. I would like all the Firebase code to be abstracted away into the framework, and therefore add Firebase to the MyFramework target in my Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'MyApp' do
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
end
On running pod install, I am able to import Firebase in all .swift files in MyFramework. However, on using import MyFramework anywhere in my app, I get the error Missing required module Firebase.
Thinking this could be a Cocoapods issue, I started a fresh project and integrated Firebase manually, but ended up with the same issue.
Is this a known issue? If so, are there any fixes for it?
In the podspec of MyFramework, add dependency of the Firebase pods. Also set the static framework flag as true. This is how your podspec should look:
*OTHER METADATA RELATED TO MYFRAMEWORK*
s.static_framework = true
s.dependency 'Firebase'
s.dependency 'Firebase/Database'
s.dependency 'Firebase/Auth'`
May be you can include this in your podfile
//As you are targeting iOS 9.0
platform :ios, '9.0'
use_frameworks!
def firebase_pods
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
end
target 'MyApp’ do
firebase_pods
Let me know if this doesn't work for you, i can try to help in other way i could