I want to integrate "Login with google" in my application. I tried to use pods, but i am getting error which is as follows:
The 'Pods-ProjectName' target has transitive dependencies that include static binaries: ProjectPath/GoogleAppUtilities/Libraries/libOpenInChrome.a
My Pod file code is as follows:
target 'ProjectName' do
use_frameworks!
pod "OAuthSwift", "~> 0.3.4"
pod "Haneke", "~> 1.0"
pod "Alamofire", "~> 1.2"
pod "IJReachability", :git => "https://github.com/Isuru-Nanayakkara/IJReachability.git"
pod "iCarousel"
pod 'SDWebImage', '~>3.7'
pod 'Google/SignIn'
end
I am using Crashlytics also. Without Google/signIn i am able to create pods workspace successfully.
Any solution on this.
Regarding cocoapods documentation for version 0.36, you can not add static libraries to your project. Google pod seems to have dependencies to some static libraries making pod install crash.
If you use ObjectiveC, and you remove the use_frameworks! part, you will have no problem.
Another option, of course, is to add the Google lib directly to the project so you won't be using cocoapods.
Add the following lines of code to your pod file to ignore transitive dependencies:
pre_install do |installer|
def installer.verify_no_static_framework_transitive_dependencies
end
end
If you're using podfile like MIHCrypto uses static libraries added all dependency libraries to project and change mach-O-Type to static as per below:
Go to your podfile and insert the following
pre_install do |installer|
def installer.verify_no_static_framework_transitive_dependencies; end
end
This worked for me.
Related
I'm trying to pod install this library into my project's (lets say child xcodeproj) parent project (lets say Parent xcodeproj).
Child .xcodeproj has its own podfile where I have added RxSwift, RxCocoa, Realm and this GeoSwift library. Here is the cocoapods file as show below
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "9.0"
inhibit_all_warnings!
use_frameworks!
project 'LocationManager/LocationManager'
def pods
pod 'GEOSwift'
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
pod 'RealmSwift', '~> 3.0'
end
target 'LocationManager' do
pods
target 'LocationManagerTests' do
inherit! :search_paths
pod 'RxBlocking', '~> 4.0'
pod 'RxTest', '~> 4.0'
end
end
This LocationManager is installed into another XCode project as another podfile
def location_pods
pod 'GEOSwift'
pod 'LocationManager', :git => 'git#github.com:myrepo/locationmanager.git', :branch => 'users/me/add-geoswift'
end
target 'TestApp' do
location_pods
project 'TestApp.project'
end
When I try to compile the TestApp target, XCode throws an error as below
GeoSwift module is not found. This error is inside the Pods > LocationManager > MockLocationManager.swift The same module imported else where in that Pods > LocationManager works. Also import RxSwift and import RxCoca works. When I accessed Pods > Targets > LocationManager > Build Phases > Target Dependencies I see all the pods except GeoSwift
May I know how to fix this issue? Adding GeoSwift to this targetDependency doesn't compile either. When compiling LocationManager.xcworkspace as a separate entity it works perfectly fine. That module import GeoSwift doesn't throw any compilation error.
I had an issue similar to this.
Go into Pods:
Then click on "Build Settings", find the row titled "Swift Language Version", and try updating it to the latest (in my case, it was 4.1).
This worked for me! Hopefully it helps someone else out there too.
More info: Xcode 9 Swift Language Version (SWIFT_VERSION)
From what I know Cocoapods do not support sub-projects. I had an issue with this too and I promoted all my sub-projects as folders within the main project and put them under a different target. Now those targets can use Cocoapods too.
I'm trying to install 'Google/Analytics' inside my lib project in podspec.
My project lib was created using pod lib create with Swift.
This is my podspec:
s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'LibPSLoginResources' => ['Pod/Resources/**/*.{xib,png,json}']
}
s.dependency 'FBSDKCoreKit'
s.dependency 'FBSDKLoginKit'
s.dependency 'Google/Analytics'
s.dependency 'Firebase/Auth'
s.dependency 'Firebase/Core'
s.dependency 'Firebase/Database'
My PodFile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
inhibit_all_warnings!
use_frameworks!
target 'LibPSLogin_Example' do
pod 'LibPSLogin', :path => '../'
target 'LibPSLogin_Tests' do
inherit! :search_paths
end
end
But when always run pod install I get this:
target has transitive dependencies that include static binaries: (/Users/macpr/Documents/Projects/iOS/LibPSLogin/Example/Pods/Google/Libraries/libGGLAnalytics.a and /Users/macpr/Documents/Projects/iOS/LibPSLogin/Example/Pods/Google/Libraries/libGGLCore.a)
I already try to put this code inside my PodFile, but the Google Analytics can't be imported by .swift file.
pre_install do |installer|
def installer.verify_no_static_framework_transitive_dependencies; end
end
As far as I know, the library project can't import static library. But what can I do to solve this problem?
Can anyone help me?
Thanks
As you may know, since Cocoapods 1.5, and possibly 1.4, it has become possible to overcome the infamous transitive dependencies issue. My approach has been to use the static framework approach now possible that means you no longer need to use #use_frameworks! in the Podfile, but instead use use_modular_headers! More can be found in the blogpost introducing Cocoapods 1.5: http://blog.cocoapods.org/CocoaPods-1.5.0/
As I know, this is impossible for such libraries. I faced the same issue several weeks ago.
https://github.com/CocoaPods/CocoaPods/issues/6526
You can take advantage of Carthage to install pure Swift framework like the repo I put it up: https://github.com/Lucashuang0802/CocoaPodsWithCarthage
My Pod file looks like this
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'GoogleMaps'
pod 'Alamofire', '~> 4.0’
pod 'SDWebImage', '~>3.8'
pod 'Applozic', '~>3.8'
pod 'Google-Maps-iOS-Utils'
end
When i install pod with all this framework Stated it gives me This error
[!] The 'Pods-MyApp' target has transitive dependencies that include static binaries: (/Users/Mad/Downloads/MyApp/Pods/GoogleMaps/Frameworks/GoogleMaps.framework)
Please help me.
I'm not saying that the answers above are wrong, but I recently cd'ed into the project instead of the project-folder which resulted in the same output.
You have to download the Utils repository locally and then import to your xcode project. A step by step guide can be found here: Integrating with Swift projects which use 'use_frameworks!' in the Podfile
First of all, I've turned on use_framework! in Podfile.
Assume the main project is MAIN_APP, and two subprojects are FRAMEWORK_A and FRAMEWORK_B.
MAIN_APP requires FRAMEWORK_A and FRAMEWORK_B, and FRAMEWORK_B requires FRAMEWORK_A as well.
All projects/targets are using CocoaPods to manage third party libraries.
For now, my Podfile looks like:
target :MAIN_APP do
project 'MAIN_APP'
pod 'PodA'
end
target :FRAMEWORK_A do
project 'FRAMEWORK_A'
pod 'PodB'
end
target :FRAMEWORK_B do
project 'FRAMEWORK_B'
pod 'PodC'
end
I manually added FRAMEWORK_A to build settings of FRAMEWORK_B, and both FRAMEWORK_A and FRAMEWORK_B to build settings of MAIN_APP.
All code compiles well, but when running the MAIN_APP crashes because it cannot load Framework of PodB.
I know I can manually add PodB to MAIN_APP and FRAMEWORK_B as well, but is it possible to define this kind of target dependency in Podfile?
Btw, when pod install, I got the warning:
[!] The Podfile contains framework targets, for which the Podfile does not contain host targets (targets which embed the framework).
If this project is for doing framework development, you can ignore this message. Otherwise, add a target to the Podfile that embeds these frameworks to make this message go away (e.g. a test target).
As I know, I can use nested target for host targets like:
target :FRAMEWORK_A
target :MAIN_APP
end
end
So CocoaPods will setup MAIN_APP to use FRAMEWORK_A and inherit pod dependencies from FRAMEWORK_A. But seems I cannot do it with multiple dependencies like:
target :FRAMEWORK_A
target :MAIN_APP
end
end
target :FRAMEWORK_B
target :MAIN_APP
end
end
Because target :MAIN_APP cannot be declared twice.
Is there any better solutions instead of defining pod dependencies as a function in Podfile and include in all target?
This is a great question and I've struggled with a similar situation. This is my PodFile:
platform :ios, '8.0'
workspace 'mygreatapp.xcworkspace'
project 'app/MyGreatApp/MyGreatApp.xcodeproj'
project 'platform/MyGreatFramework/MyGreatFramework.xcodeproj'
abstract_target 'This can say whatever you want' do
target 'MyGreatApp' do
project 'app/MyGreatApp/MyGreatApp.xcodeproj'
pod 'AFNetworking', '~> 2.6.0'
pod 'PromiseKit', '~> 1.5'
pod 'PromiseKit/Join'
pod 'KVOController', '~> 1.0'
pod 'FLAnimatedImage', '~> 1.0'
pod 'Crashlytics', '~> 3.3'
pod 'SSZipArchive'
end
target 'MyGreatAppTests' do
project 'app/MyGreatApp/MyGreatApp.xcodeproj'
pod 'OCMock', '~> 3.1'
end
target 'MyGreatFramework' do
project 'platform/MyGreatFramework/MyGreatFramework.xcodeproj'
pod 'SSZipArchive'
end
target 'MyGreatFrameworkTests' do
project 'platform/MyGreatFramework/MyGreatFramework.xcodeproj'
pod 'OCMock', '~> 3.1'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
end
As you can see I'm not using frameworks and I use an abstract_target to group it all together. I wish these kinds of dependencies were easier to do in CocoaPods. I know this doesn't really answer your question but it might be helpful nonetheless.
I think you can also get around this by just making FrameworkA and FrameworkB into local (static library) pods and it will de-duplicate everything for you and integrate it into the host app properly.
Examples: https://github.com/rob-keepsafe/PodFrameworksIssue
master branch shows duplicate classes and umbrella frameworks like you have
deduped branch makes the internal dynamic frameworks into local pods (as static libs) to de-dupe and still link in the dependencies
I'm not entirely sure your issue is the same as mine, but I'm going to leave my solution here just-in-case someone has a similar issue.
I have a project with multiple sub-projects I use to modularize my code (and potentially prepare to extract to my own private pods).
I had the issue of one importing an external pod to one of the sub-projects, and receiving a dyld error due to a "missing image".
I found this Medium article from which I concluded that I had to always include the pods in the main project for the sub-projects to be able to find them. Neither of my external pods are used in the main project.
( https://medium.com/#akfreas/how-to-use-cocoapods-with-your-internal-ios-frameworks-192aa472f64b )
(I'm probably not writing the podfile as correctly or efficiently as I could, but this seems to fix my issue)
My podfile is therefore as follows:
abstract_target "RandomName" do
target "MainProject" do
inherit! :complete
workspace './MainProject.xcodeproj'
pod 'Moya', '~> 13.0'
pod 'KeychainSwift', '~> 17.0'
end
target "ModuleA" do
project './ModuleA/ModuleA.xcodeproj'
workspace './ModuleA/ModuleA.xcodeproj'
pod 'Moya', '~> 13.0'
end
target "ModuleB" do
project './ModuleB/ModuleB.xcodeproj'
workspace './ModuleB/ModuleB.xcodeproj'
pod 'KeychainSwift', '~> 17.0'
end
end
I am using xcode 8 for development and cocoapods 1.0.1 for frameworks. After installing frameworks, i couldn't able to build my project. I am getting "ld: framework not found" error. I am using following lines in pod file:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'Sample' do
use_frameworks!
pod 'MBProgressHUD', '~> 0.9'
pod 'TPKeyboardAvoiding', '~> 1.2'
pod 'SDWebImage', '~> 3.7'
pod 'UIActivityIndicator-for-SDWebImage'
pod 'UITextView+Placeholder', '~> 1.2'
pod 'Alamofire', '~> 4.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
After installing the frameworks, did you closed your project and opened the newly created workspace?
Once you start using CocoaPods to install framework, you must use the workspace as it includes your Sample project and the Pod project containing the frameworks.
In you project directory, make sure to open the .xcworkspace instead of .xcodeproj.
Edit:
If that is not the issue, go to your Sample target/General/Linked Framework and Librairies
You should only have one that should be name something like: Pods_Sample.framework
If you are only using cocoa pods to install frameworks it should be the only one there as it includes all the pods.
select your target -> General ->Embedded Binary , click + ,and add Alamofire.framework
try adding project 'APP_NAME.xcodeproj' to your podfile after use_frameworks! and do pod install again
if you receive warnings like below, after pod install
[!] The `APP_NAME [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-BasePods-APP_NAME/Pods-BasePods-APP_NAME.debug.xcconfig'. This can lead to problems with the CocoaPods installation
Go to Build Settings of your target and add $(inherited) to Framework Search Paths
I had this problem, and it happened a while after renaming my project.
It was using my Pod_Old_Project_Name as a framework.
I fixed this by going to Build Phases -> Link Binary With Libraries, and removed that framework.
There are two reasons this error occurs
I have faced the same issue, This comes only due to change in the
pod file or maybe the pod file may not exist, double check the pod
file and run the cmd pod install
After successfully installing the pod file still if you getting this
error please restart the Xcode, error goes away