I want to use JCDialPad and Alamofire at same time from CocoaPods. Below is how my pod file looks:
use_frameworks!
pod 'Alamofire', '~> 3.4'
pod 'Kingfisher', '~> 2.4'
pod 'JCDialPad', :podspec => './podspec'
Note that JCDialPad is already having dependency on libPhoneNumber-iOS.
Now I have add my bridging header file in Build Settings and is detected properly. But my question here is Alamofire will be compiled and build as Dynamic Framework. But JCDialPad is NOT meant to be used as Dynamic Framework.
How will cocoapods podfile to be written so that only Alamofire and Kingfisher will be used as Dynamic Framework and JCDialPad will be used as Static Library?
Any hint will be useful.
I believe what you are asking for is not possible at all. Please refer to the detailed discussion here
Related
our project is an Objective-c project.
Since we're using react-native-firebase we can't use use_frameworks! in cocoapods any more.
The problem is we have a swift pod dependency (PromiseKit) and to use swift dependencies we must use use_frameworks! as far as I understand.
What I'm trying to do is have the best of both worlds, aka:
remove use_frameworks! so that react-native-firebase works AND
keep the PromiseKit swift dependency.
current Podfile:
platform :ios, '10.0'
target 'TestApp' do
use_frameworks!
# swift pod
pod 'PromiseKit'
# react-native-firebase
pod 'Firebase/Core', '~> 5.3.0'
pod 'Firebase/DynamicLinks', '~> 5.3.0'
pod 'Firebase/Messaging', '~> 5.3.0'
end
I noticed there's this command :modular_headers => true or use_modular_headers which I sense may or may not be relevant to the solution I'm looking for since Cocoapods 1.5 but I can't seem to connect the dots.
Edit:
If I remove use_frameworks! (even if I replace it with use_modular_headers!) I get this error:
Any help please?
Replace use_frameworks! with use_modular_headers! in the Podfile.
From the CocoaPods 1.5 release note referenced:
With CocoaPods 1.5.0, developers are no longer restricted into
specifying use_frameworks! in their Podfile in order to install pods
that use Swift. Interop with Objective-C should just work. However, if
your Swift pod depends on an Objective-C, pod you will need to enable
"modular headers" (see below) for that Objective-C pod.
With CocoaPods 1.9.0, it is now possible to build frameworks both statically and dynamically. Use use_frameworks! :linkage => :static
I have also faced this issue. and find a perfect solution for this.
https://github.com/joncardasis/cocoapods-user-defined-build-types
this is a plugin for cocoapods by which we can specify to use "dynamic framework" (i.e. what "use_framework" does) on a particular pod. this feature is not currently supported in cocoapods, that is why use this plugin to resolve your issue.
I ran into a similar issue last week, so I created a basic project where I'm using Swift, Firebase but not use_frameworks!, instead using bridging headers.
Don't know if people are still having issues with this, let me know if it helps. https://github.com/jenshandersson/React-Native-Swift
I am trying to add multiple library using pod setup, but unfortunate not success.
My Pod Setup
platform :ios, "8.0"
use_frameworks!
target 'Demo Cluster' do
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'Google-Maps-iOS-Utils'
pod 'Alamofire', '~> 3.4'
end
I get This Error
Until GoogleMaps is released as a dynamic framework, you can only support it as a transitive dependency as a library. However, as you are using a swift framework - you can't support that either. Your best option is to request Google release their libraries as a dynamic framework.
You can try to download them manually and insert them but I think it will not work neither.
I suggest you to read this discussion.
From this dicussion:
Until GoogleMaps is released as a dynamic framework, you can only
support it as a transitive dependency as a library. However, as you
are using a swift framework - you can't support that either. Your best
option is to request Google release their libraries as a dynamic
framework I'm afraid.
Is there a way to install this library without cocoapods ? because when i install it with pod i get this 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 Pods being used are:
CryptoSwift and JSONWebToken
And when i add 'use_framewords!' i got error on the other libraries written with objective-c that use pod also
Here is my podfile :
source “https://github.com/CocoaPods/Specs.git”
platform :ios, '8.1'
pod 'GoogleMaps'
pod 'RSKImageCropper'
pod 'AFNetworking', '~> 3.0'
pod 'DZNEmptyDataSet'
pod 'Instabug'
Thank's in advance
You can drag and drop the
link
sources into your project. If you add the library in this way, you
will update the library manually as you know.
The second option is using cocoapods and solving the problem. When you use use_frameworks! cocoapods tries to convert the whole pods as framework, so the error should be in your bridging header. Try to import your frameworks in your files.
I have just started a new Swift project and I would like to use different libraries. In particular, I would like to use Realm.io, an Obj-C library. But, I would also like to use pure Swift libraries such as Alamofire or Dollar.
I use Cocoapods for managing my dependencies. I use the latest version (0.37.0) and the new use_frameworks! flag. pod install is successful anytime.
Unfortunately, when I try to build my project I get two errors (for my main target):
Umbrella header Realm.h not found from module.modulemap
Could not build Objective-C module Realm from any file using import Realm
Other imports work fine.
I have noticed the following: if I remove pure Swift libs and use_frameworks, everything works fine. I am aware about this current issue from Cocoapods. However, it should not be a problem for Realm asks developers to use that flag.
Here is my Podfile:
platform :ios, '8.0'
use_frameworks!
target 'rothrock' do
pod 'Realm'
pod 'Cent'
pod 'SwiftyJSON'
pod 'Alamofire'
end
target 'rothrockTests', :exclusive => true do
end
I use no bridging header. Should I?
Any idea or workaround?
Alright, here is the full walkthrough:
Install dependencies using Cocoapods and the use_frameworks! flag.
As you need to use a Objective-C dependency, create a Bridging header. You can create one easily by importing an Objective-C class to your Swift project, than remove it (the wizard should ask you if need a bridging header). Otherwise, create a new header file. Then, navigate to your target configuration and enter the name of your file in Swift Compiler - Code Generation > Objective-C Bridging header.
Still in your target configuration, add a new entry in Search Paths > User Header Search Paths: Pods as value and flag it as recursive.
Remove any import instruction from your code, relative to your Objective-C library.
Build your project. You should have a success.
You need a bridging header and import your Objective-C library headers there.
If you are using only Realm you can check out this documentation for Swift http://realm.io/docs/cocoa/ (go to CocoaPods down in the tabs)
Swift
Install CocoaPods 0.36.0 or later ([sudo] gem install cocoapods).
In your Podfile, add use_frameworks! and pod 'Realm' to your app target.
From the command line, run pod install.
Use the .xcworkspace file generated by CocoaPods to work on your project!
Download the latest release of Realm and extract the zip.
Drag the file at Swift/RLMSupport.swift into the File Navigator of your Xcode project, checking the Copy items if needed checkbox.
I just installed the Realm library in a project I have with some of the libraries you mention above like Alamofire and SwiftyJSON and others and it works fine when you build the project and even put the import Realm, no compilation errors at all.
I'm using Cocoapods 0.36.0, the stable version and this is my PodFile :
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '8.0'
link_with 'ApiWorkflow', 'ApiWorkflowTests'
pod 'SwiftyJSON', '~> 2.2'
pod 'Alamofire', '~> 1.2'
pod 'Typhoon', '~> 3.0'
pod 'SwiftCSV', '~> 0.1'
pod 'Realm'
I hope this help you
I would like to use zipzap library in my swift ios project.
I use cocoapods to integrate it. When I run pod install everything works fine, but when I do import zipzap, it says Could not build Objective-C module 'zipzap'.
I've done everything that people recommend here and in similar questions. But no luck.
Is it possible that this library simply not compatible with swift-based projects?
This is my Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'MyProject-iOS' do
pod 'Reachability', '~> 3.2'
pod 'SwiftyJSON', '~> 2.1'
pod 'zipzap', '~> 8.0'
end
target 'MyProject-iOSTests' do
end
I faced the same issue. Looks like the podspec for zipzap is missing. Due to which pod ends up making all header files public. And that is what causes the issue.
I wrote my own podspec file which only makes five headers public, rest are private. This decision was based on the podspec.json found in the zipzap repo.
I included zipzap in my project as follows:
pod 'zipzap', :podspec => 'https://raw.githubusercontent.com/tahasamad/zipzap/master/zipzap.podspec'
I'm the author of ZipZap. Version 8.0.4 now properly supports iOS and OS X frameworks, both with and without CocoaPods. After updating with CocoaPods, you should just be able to import ZipZap in Swift and "it just works".
In order to get correct exception handling, you'll have to use CocoaPods 0.36 or later, otherwise you may get some build warnings.