Firebase ambiguous reference "FIRMessagingAPNSTokenType... is ambiguous" - ios

After upgrading the Firebase Pods the project have ambiguous reference problems, any suggestions?
when I use the Pods with Version 4.10.0 it works perfectly, but if I use the latest version (5.0.0) I get the error.
My Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'AppName' do
pod 'OpenSSL-Universal'
pod 'Firebase/Core', '4.10.0'
pod 'Firebase/Messaging', '4.10.0'
pod 'GoogleToolboxForMac/Logger'
pod 'AppCenter'
end
target 'AppName DEV' do
pod 'OpenSSL-Universal'
pod 'Firebase/Core', '4.10.0'
pod 'Firebase/Messaging', '4.10.0'
pod 'GoogleToolboxForMac/Logger'
pod 'AppCenter'
end`
Thaks and advance!!

This usually happens if you have the same class in 2 different frameworks. Can it be that you reference both 4 and 5 at the same time?
Try to comment out "BRy-Autenticador DEV" section and build only the 'BRy-Autenticador' target.
Check your Podfile.lock after running "pod install". It should contain only one version of Firebase frameworks.

I solved this problem writing...
[FIRMessaging messaging].APNSToken = deviceToken;
instead...
On didRegisterForRemoteNotificationsWithDeviceToken method.
Thanks!!

Related

Upgrade to FirebaseCrashlytics and 'No such module FirebaseCrashlytics'

I am trying to upgrade to FirebaseCrashlytics from Crashlytics. I am able to import Firebase but not FirebaseCrashlytics. Here is my podfile:
platform :ios, :deployment_target => "9.0"
def shared_pods
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'SVProgressHUD'
pod 'IGHTMLQuery'
pod 'OpenTok', '~> 2.16.3'
end
target 'MyApp' do
#use_frameworks!
shared_pods
end
I cannot uncomment use_frameworks! since it breaks other pods I am already using.
My bridging header:
#import "FirebaseCrashlytics/FirebaseCrashlytics.h"
#import "FirebaseCore/FirebaseCore.h"
This is what I am getting:
According to the firebase docs then you just have to import Firebase, not FirebaseCrashlytics.
https://firebase.google.com/docs/crashlytics/get-started?platform=ios
If you're using it as a Swift framework then make sure you add it to your target's Frameworks, Libraries, and Embedded Content

swift linker command failed with exit code 1 Google Maps iOS Util pod install

My build failed with swift linker command failed with exit code 1. The logs specifically say symbol(s) not found for architecture x86_64
This happened ever since I tried setting up Google-Maps-iOS-Utils.
This is my Podfile. There is a pre_install portion because without it, pod install will have a 'Pods-Project' target has transitive dependencies that include static binaries error.
# platform :ios, '9.0'
target 'My App' do
use_frameworks!
platform :ios, '11.3'
# Pods for My App
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils' #the new pod that caused issues
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'GoogleSignIn'
pod 'Firebase/Database'
pod 'Firebase/Storage'
pod 'FirebaseUI/Storage'
pod 'Fabric', '~> 1.7.9'
pod 'Crashlytics', '~> 3.10.5'
target 'My AppTests' do
inherit! :search_paths
# Pods for testing
end
end
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end
This is my Bridging-Header.h
#ifndef Bridging_Header_h
#define Bridging_Header_h
#import <Google-Maps-iOS-Utils/GMUMarkerClustering.h>
#endif /* Bridging_Header_h */
Some troubleshooting measures I tried:
Cleaning Build Folder and Building again;
de-integrating pods and pod installing again.
Any help is appreciated. Thanks.
This solution worked for me. There is no need for this portion in the Podfile as well.
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end
I also had to delete the framework the binary search path in Build Phases.
Try to add library location in binary search path of build setting.

Xcode 10 Realm Swift "Module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2 compiler"

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.

Getting errors: framework not found FirebaseCore

I keep getting the following error
ld: framework not found FirebaseCore
clang: error: linker command failed with exit code 1 (use -v to see invocation)
here is the pod file
platform :ios, '11.4'
target 'Myproject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
#use_frameworks!
use_modular_headers!
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Storage'
pod 'Firebase/Crash'
pod 'FirebaseStorageCache'
end
I have been struggling with this issue for days now. Request your help.
close xcode
pod reintegrate
pod install
open xcode
cmd+k
built

Pods library is linked twice with first target, as libPods.a and libPods-<targetname>.a

I have the project, that contains two targets one for iOS and one for OSX.
Here's how the Podfile looks like.
# Pods
xcodeproj 'ipolypus.xcodeproj'
pod 'BlocksKit'
pod 'Reachability'
pod 'MKStoreKit'
# Objective C
pod 'libextobjc'
pod 'LinqToObjectiveC'
target :ipolypus, :exclusive => false do
platform :ios, '5.1.1'
pod 'CocoaLumberjack'
pod 'EGOTableViewPullRefresh'
pod 'SVProgressHUD'
pod 'FlurrySDK'
# AdMob SDK and AdMob mediation adapter
pod 'AdMob'
pod 'AdMobMediationAdapterIAd'
end
target :ipolypusTests, :exclusive => true do
pod 'CocoaLumberjack'
end
target :'ipolypus-osx', :exclusive => false do
platform :osx
pod 'CocoaLumberjack'
end
After running pod install I can see that two Pods libraries are linked against the first target (ipolypus).
libPods.a and libPods-ipolypus.a
If I try to build the project right away, I will get strange link errors, like missing FlurrySDK symbols.
To fix it, I have to remove libPods.a and libPods-ipolypus.a from the list of libraries to link with the target, run pod install again, then manually remove libPods.a for the first target and then it will build and link.
There must be something wrong with the way I make that Podfile. I checked related posts, couldn't find similar problem.
Update
Here's the link error
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Flurry", referenced from:
objc-class-ref in IOSAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After I do the steps described above, I will have successful builds until next pod install or pod update.
I should also mention, that the project had single target for quite a while, then I added OSX target and modified Podfile for that, and that's when the problems started.
But I tried to remove Podfile.lock and to wipe Pods folder, still the problem occurs.
And I had another type of error, where linker failed because the same symbol was already defined, but I don't see that one anymore.
I got to the cause of "double-linking" problem.
It's caused by the structure of the Podfile, as expected.
Since I wanted to have some common pods available both for OSX and iOS targets, I put them all in the beginning.
xcodeproj 'ipolypus.xcodeproj'
pod 'BlocksKit'
pod 'Reachability'
pod 'MKStoreKit'
# Objective C
pod 'libextobjc'
pod 'LinqToObjectiveC'
These common pods will be in libPods.a library, also, CocoaPods can't stand the fact that some pods library is not linked against a target, so it will link libPods.a against default project target, in my example it's ipolypus.
Then there's libPods-ipolypus.a generated for ipolypus iOS target. Since this target is not exclusive, things like FlurrySDK will be included into both libPods.a and libPods-ipolypus.a, resulting into duplicated symbols while linking.
After trying to figure out the proper way to use exclusive/non-exclusive target configs, I ended up with separate list of pods for each target. Might be a bit longer than I would want, but does the job as expected.
# Pods
xcodeproj 'ipolypus.xcodeproj'
target :ios, :exclusive => true do
platform :ios, '6.0'
link_with 'ipolypus'
# shared
pod 'CocoaLumberjack'
pod 'Reachability'
pod 'MKStoreKit'
pod 'LinqToObjectiveC'
# pod 'EGOTableViewPullRefresh'
# platform
pod 'SVProgressHUD'
pod 'FlurrySDK'
# AdMob SDK and AdMob mediation adapter
pod 'Google-Mobile-Ads-SDK'
pod 'AdMobMediationAdapterIAd'
end
target :iosTests, :exclusive => true do
platform :ios, '6.0'
link_with 'ipolypusTests'
pod 'OCMock'
end
target :osx, :exclusive => false do
platform :osx, '10.7'
link_with 'ipolypus-osx'
# shared
pod 'CocoaLumberjack'
pod 'Reachability'
pod 'LinqToObjectiveC'
end
target :osxTests, :exclusive => true do
platform :osx, '10.7'
link_with 'ipolypus-osxTests'
pod 'OCMock'
end

Resources