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

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

Related

Redefinition of module 'Firebase'

I'm trying to integrate Firebase into my app, but as soon as I'm building it after I thought I finished my install I get:
Redefinition of module 'Firebase'
as well as
Could not build Objective-C module 'SwiftOverlayShims'
which I have no idea what that means but I'm assuming its a result of the first.
My podfile looks like this:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'app' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'Firebase/Auth'
# Pods for app
end
So I don't think theres anything conflicting there. I saw a solution that told me to go into my Header Search Path and see if my project had multiple Firebase directories, but I have no custom paths, so that wasn't it. Any insight?
EDIT: Here is the exact display from my errors
Uncommenting the platform line in my podfile and changing it to iOS 10.0 did get rid of the error saying "Could not build Objective-C module 'Firebase'" So we have made some progress.
Here is the path when selecting "previously defined here"
From what I can tell, it is only giving me one location. Selecting the redefinition error just gives me the relative path of module.modulemap , so I am assuming that is referring to the same thing. I am also getting multiple warnings like this
Skipping duplicate build file in Copy Files build phase: /Users/me/Library/Developer/Xcode/DerivedData/app-elgcucdextsnzqbtlznbqeulbfks/SourcePackages/artifacts/Firebase/FirebaseAnalytics.xcframework/ios-arm64_i386_x86_64-simulator/FirebaseAnalytics.framework
as well as a couple other frameworks in the ios-arm64_i386_x86_64-simulator directory, so maybe that has something to do with it.

XCFramework "Cannot load underlying module"

I've built an SDK as an XCFramework, which shares dependencies with the app that uses it. When I build, I'm getting:
...SDK.swiftmodule/arm64-apple-ios.swiftinterface:20:8: Cannot load underlying module for...
This occurs in the Compile Swift Sources action and the break is in the import MySharedDepedency statement in the swiftinterface file
As stated, the SDK in the project as an xcframework bundle. MySharedDependency is fulfilled with cocoapods. use_modular_headers is set in the Podfile, it's modulemap is included in the linker flags (by cocoapods).
Its DOES work if I use the use_frameworks! flag in the Podfile but only with dynamic linkage and for internal politics reasons, I need this to work with static linkage. If I add the :linkage => :static argument, I get the same error as with no use_frameworks! call
I've tried changing the order of the linked frameworks in Build Phases (so that the pods are linked before the SDK framework). I've tried adding recursive header/framework/module search paths everywhere I can find a MyDependency.modulemap...
Yes, I've cleaned caches, deintegrated, clean installed, erased deriveddata, restarted xcode, my machine, ...
Argh! Thanks for any help...
I had the same exactly the same scenario and the same problem
I solved using #_implementationOnly in every file from my xcframework's code like:
#_implementationOnly import Alamofire
After that just rebuild your XCFramework, clean and build your app's project.
It works like a charm without use_frameworks!

How to link CocoaImageHashing pod with Swift project (dyld: Library not loaded)

I'm trying to use the CocoaImageHashing pod from a Swift project so that I can do some perceptual hashing for image duplicate detection.
I setup the workspace following the CocoaPods instructions and attempted to run the default Hello World swift file.
dyld: Library not loaded: #rpath/CocoaImageHashing.framework/Versions/A/CocoaImageHashing
Referenced from: /Users/sarge/Library/Developer/Xcode/DerivedData/PHashTest-cdongczzcrynrfclysczwalanrlq/Build/Products/Debug/PHashTest
Reason: image not found
(lldb)
My Podfile is:
platform :osx, '10.12'
target 'PHashTest' do
use_frameworks!
pod 'CocoaImageHashing', :git => 'https://github.com/ameingast/cocoaimagehashing.git'```
end
I tried commenting out the use_frameworks! line in case this was some kind of dynamic library problem. I then get a build error.
Framework not found CocoaImageHashing
My General > Linked Frameworks and Libraries does include the CocoaImageHashing framework. I see Xcode building files from it during a build.
Is there something I have to do to get the CocoaImageHashing pod to build the dynamic library that Swift expects? Or do I need to not use Swift because CocoaImageHashing has to be included dynamically.
(I'm very unfamiliar with Swift so I don't know what to look for)
You should include the framework at General -> Embedded Binaries as well.

How to use FMDB with cocoapods and swift?

It looks like cocoapods supports FMDB:
pod 'FMDB/FTS'
But even after creating a bridging header I get the following error:
cocoapods bridging header error: 'FMDB.h' file not found
What's up?
Turns out I also needed to add a header search path.
In your target's settings (not project settings) navigate to Build Settings -> Header Search Paths and add the following non-recursive path:
"${PODS_ROOT}/FMDB/src/fmdb"

Library not found for -lFirebase after installing XLForm

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.