Library not found for -lFirebase after installing XLForm - swift

I have a project in Swift where I use some libraries. When I run on the simulators or on the physical device, it runs perfectly. But by the time I try to archive the project to send it to the store, I receive the following error message:
ld: library not found for -lFirebase
The problem is when I use the XLForm library, which was the last modification I have done to my Podfile.
I am using the .xcworkspace since I started using the CocoaPods, and I have never had any problem before.
My Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!
pod 'Firebase', '= 2.5.0'
pod 'Google/CloudMessaging'
pod 'Google'
pod 'Google/Analytics'
pod 'XLForm', '~> 3.0'
target 'Dimmi' do
end
target 'DimmiTests' do
end
target 'DimmiUITests' do
end
The XLForm library does not depends on any other library or framework. Also, I tried to install it manually with no success.

You need to create a bridging header file and import the Objective-C framework through it.
Create a new header file and name it in the following pattern:
ProjectName-Bridging-Header.h
Then add your framework header to it
#import Framework.h
Then add the bridging header to your build settings under Objective-C Bridging Header.

Related

How to integrate FBSDKCoreKit into a Swift custom Framework?

Did anyone managed to integrate FBSDKCoreKit to a custom swift framework with cocoapods (or alternate method)?
When I do this (experiment 1):
target 'MyFramework' do
project 'MyFrameWork/MyFramework.xcodeproject'
pod 'FacebookSDK', :modular_headers => true
end
target 'MyApp' do
workspace 'MyWorkspace.xcworkspace'
project 'MyApp/MyApp.xcodeproj'
inherit! :complete
target :MyAppTests
target :MyAppUITests
end
I get No such module 'FBSDKCoreKit' when compiling the framework (same applies when setting modular_headers => false.
I have also tested use_frameworks! as follows: (experiment 2):
target 'MyFramework' do
project 'MyFrameWork/MyFramework.xcodeproject'
use_frameworks!
pod 'FacebookSDK'
end
target 'MyApp' do
workspace 'MyWorkspace.xcworkspace'
project 'MyApp/MyApp.xcodeproj'
inherit! :complete
target :MyAppTests
target :MyAppUITests
end
But then I get this error:
dyld: Library not loaded: #rpath/Bolts.framework/Bolts
Referenced from: /private/var/containers/Bundle/Application/***/MyApp.app/Frameworks/MyFramework.framework/MyFramework
Reason: image not found`.
Note: When I add the FacebookSDK to MyApp (with use_frameworks!) it works, but then, I can't make use of it from within MyFramework (hence useless to me).
I finally found another way to do that, so I dropped Cocoapods.
I stumbled upon the fact that Facebook publishes a Swift package (https://swiftpackageregistry.com/facebook/facebook-ios-sdk).
So I proceeded as follows:
removed pod 'FacebookSDK' from my pod file;
added the above mentioned package for my framework.
And voila!

No such module 'InputBarAccessoryView'

Trying to get MessageKit setup within my project. I'm getting the following error - 'No such module 'InputBarAccessoryView' within the
MessagesViewController+Keyboard.swift:26:8: No such module 'InputBarAccessoryView'
I've tried installing pods, updating pods and deintegrating.
import Foundation
import InputBarAccessoryView
Should compile normally. Only error that persists.
In My case i will update pod file Ios version
# Uncomment the next line to define a global platform for your project
platform :ios, '14.0'
target 'Messanger' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Messanger
pod 'InputBarAccessoryView'
end

Using static libraries in Swift with CocoaPods fails for Realm

Since Xcode 9 it is possible to use static libraries by omitting the use_frameworks! flag in the Podfile. However, when used with the Pod RealmSwift this results in the following error:
[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod `RealmSwift` depends upon `Realm`, 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.
Sadly, the proposed solution with use_modular_headers! does not work.
Other things I have tried include:
Using the latest Realm version (3.15.0)
Use the Objective C version and add Swift support, this won't build and give a module not found error in the RLMSupport.swift file .
Adding a bridging header for the Objective C version.
Endless clean, rebuild, Xcode relaunches and Derived Data folder cleaning.
It would not be preferable to circumvent CocoaPods and have this dependency be installed in a separate way, since that would make updating a more complex process. I hope there is a solution that works with CocoaPods, Realm and Swift.
I did the job doing following:
pod 'RealmSwift', '~> 3.17', :modular_headers => true
pod 'Realm', '~> 3.17', :modular_headers => true
As far as I can tell adding use_modular_headers! to top of Podfile works.
Adding s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } to .podspec doesn't work as far as I can tell. (Cocoapods 1.6.0-beta.2)
example:
target 'Opportunity' do
use_modular_headers!
end
I don't see why it wouldn't work. I got the same issue, and I added use_modular_headers! following way in the podfile and it worked.
target 'Pick Up Lines' do
use_modular_headers!
pod 'RealmSwift'
end
By the way, before doing any of it, make sure, you set the deployment target of the project as 11.0.

Why I cant import the library that in swift file after installing the the dependency in Cocoapods?

I already install this library, XLPagerTabStrip via Cocoapod. My pod file is look like this,and already hit pod install in terminal.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyProject
pod 'XLPagerTabStrip', '~> 8.0'
end
So everything is completed install,but when I want to import the library in Swift file,it giving an error ->> No such module 'XLPagerTabSript'.
I read a lot of question about this,which mention add the file path of the library to
Build Setting -> Search Paths -> User Header Search Paths. I also already did,but still giving the same error.
What I add in User Header Search Path is something like this:
${SRCROOT}/Users/Myname/Desktop/MyProject/Pods/XLPagerTabStrip
After adding the file path,I clean the project,build the project again,the tried to add in import XLPagerTabStrip to one of my swift file,the error still the same.
Can somebody let me know what is problem actually? Cause I beginner in Ios development,I totally no idea what I doing wrong.
I end up solve it by update my Xcode vesion and insert the file path of the library in inside
Build Setting -> Search Paths -> Framework Search Paths -> (Add the
file path of the library here)
By this I can import the library in swift file without any warning

Adding static libraries to pod spec file

I am trying to create a framework out of the app that is using Google maps now.
This is my FuelMap framework podspec
target 'FuelMap' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'GoogleMaps'
end
podspec:
Pod::Spec.new do |s|
...
s.dependency 'GoogleMaps'
s.dependency 'Google-Maps-iOS-Utils'
end
Then, I have a regular project which has this pod file
target 'Mock' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'FuelMap', :path => './FuelMap'
end
Since the regular project is using use_frameworks
I keep running into this error whenever I do pod install
The 'Pods-Mock' target has transitive dependencies that include static binaries:
Is there a work around, so that I can have the library file from GoogleMap Ios statically in the touch framework and then add them as a reference in the pod spec file. So the error would be avoid?