My project include three target: App, Lib. Lib is depended on Alamofire via Cocoapod, and have umbrella header named Lib.h
Inside a swift source file of App target i use
import Lib
and compiler complain that
missing required module: 'Alamofire'
My podfile is something like this :
source 'https://github.com/CocoaPods/Specs.git'
workspace '../Myworkspace'
xcodeproj 'MyProject'
platform :ios, '8.0'
use_frameworks!
link_with 'Lib'
pod 'Alamofire'
Related
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!
I'm embedding frwkproject.xcodeproj product (frwkproject.framework) in the mainproject.xcodeproj project.
I am trying to use Firebase Library in the frwkproject.framework only. Using this cocoa pods:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
workspace 'frwkproject.xcworkspace'
abstract_target 'Shows' do
pod 'Toaster'
target 'frwkproject' do
project 'frwkproject/frwkproject.xcworkspace'
pod 'Firebase/Core'
pod 'Firebase/Crash'
end
target 'mainproject' do
project 'mainproject/mainproject.xcodeproj'
end
end
In the mainproject project I have imported the framework with:
import frwkproject
And this error appears: "Missing required module Firebase"
Importing the cocoa pods library in both projects avoids this problem. Like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
workspace 'frwkproject.xcworkspace'
abstract_target 'Shows' do
pod 'Toaster'
pod 'Firebase/Core'
pod 'Firebase/Crash'
target 'frwkproject' do
project 'frwkproject/frwkproject.xcworkspace'
end
target 'mainproject' do
project 'mainproject/mainproject.xcodeproj'
end
end
But Firebase will crash when imported in both project.
Is it possible to implement Firebase in the framework project only?
Ok, got exactly the same problem. Here is how I've resolved it:
added
pod 'Firebase/Core'
in a child project pod target
added
pod 'GoogleToolboxForMac'
pod 'nanopb'
in a main project pod target (these are dynamic pod dependencies of Firebase)
added recursive $(SRCROOT)/Pods/Firebase in main target Build Settings -> Header Search Paths (got that idea from here).
Hope that helps!
I have an existing project written in Objective C which contains private pods. I am writing a new private pod in swift language and need to integrate with existing objective C project as i have to go with Mix and Match approach. When I give "pod install" command i am getting below error
"[!] Pods written in Swift can only be integrated as frameworks; add
use_frameworks! to your Podfile or target to opt into using it. The
Swift Pod being used is: XXXXXNetworkManagerSwift"
Here "XXXXXNetworkManagerSwift" is a new pod written in Swift language. It is a framework template.
Existing private pods are written using static lib templates.
My podfile is as below where i am using XXXXXNetworkManagerSwift as a dependency
Podfiile:-
source 'https://github.com/xxxx/ios-specs.git'
source 'https://github.com/cocoaPods/Specs.git'
platform :ios, ‘8.0’
use_frameworks!
target 'XXXXFoundationFramework' do
podspec :path => 'XXXFoundationFramework.podspec'
end
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.
XCode 7.2.1
Swift 2
CocoaPods 0.39.0
Podfile:
platform :ios, '8.0'
use_frameworks!
target 'vent-ios-client' do
pod 'TwilioSDK', ' ~> 1.2.0'
end
According to this and this I don't need to create a Bridging-Header.h file or tweak my header search paths if I use use_frameworks!. I should just be able to import the pod by it's name and it should work.
But all of the following result in "No such module" errors:
import TwilioSDK
import TCDevice
import TCDevice.h
import TwilioSDK/TCDevice
import TwilioSDK/TCDevice.h
Here is what the TwilioSDK file structure looks like:
I am loading my project's .xcworkspace file. And pod install completed successfully.