I have added AFNetworking through cocoa-pod and it's working fine now i need to add one more library . so can i use the existing pod file or i should create new one
please help me here how to do that.
You can add your pod like this. And after you done that you should run a pod install.
# 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!
target 'myproject' do
pod 'AFNetworking', '~> 3.0'
pod 'GoogleAnalytics', '~> 3.14'
pod 'Mantle', '~> 2.0'
pod 'PureLayout', '~> 3.0'
end
Yes, you only need one pod file per project. I recommend that you look into the guides about using cocoapods on their website.
https://guides.cocoapods.org/using/index.html
I would recommend that you use the cocoapods OS X application as it will help you create pod files and update them.
https://cocoapods.org/app
Use Existing Pod file -> Open -> Add the library name.
If you add your library then open Terminal window, set your project path, then install, its finally installed the Library.
Terminal window -> cd path -> pod install
hope its helpful
Related
Working from an app that's pushing 8 years old now. Was written in Objective C. The podfile looks like this.
platform :ios, '6.0'
pod 'AFNetworking', '~> 1.2.0'
pod 'MBProgressHUD', '~> 0.6'
platform :ios, '7.0'
pod 'MessageBanner', '~> 1.0'
I'd like to add new pods to the project. Namely, Stripe. Stripe runs successfully on my local machine from a different Xcode project that uses this podfile syntax.
platform :ios, '9.0'
target 'Superapps' do
use_frameworks!
pod 'Alamofire', '~> 4.5'
pod 'AlamofireImage', '~> 3.3'
pod 'Stripe'
pod 'Cards'
end
Is there a way to run a terminal command that can add the new pods to the project while leaving the existing dependencies intact? Whenever pod install or pod install --no-repo-update is used after adding the new pods to the project, an eventual compiler warning no such module stripe is displayed by Xcode. Is there a way to fix this?
For the life of me, every edit that has been tried, including changes to the podfile and a slew of different terminal commands either produce an App project that can run the dependencies before the update but always the no such module stripe warning error. I've contacted Stripe, and am now in communication with Apple for their Code Level Support for the Apple developer program.
Note: Apple has expressed that their code level support only pertains to Apple frameworks...
I just installed pod with this command
sudo gem install cocoapods
git cloned a project from git repository and run pod install --verbose and I get this error:
Resolving dependencies of `Podfile`
[!] Unable to integrate the following embedded targets with their respective host targets (a host target is a "parent" target which embeds a "child" target like a framework or extension):
- MyApp (true) and OneSignalNotificationServiceExtension (false) do not both set use_frameworks!.
I can't get this app tower inside Xcode because of this. I get this error message:
update
this is my (the only one) Podfile
update 2
after putting up the use_frameworks! line I get this:
add use_frameworks! to solve this problem on OneSignalNotificationServiceExtension.
target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignal', '>= 2.5.2', '< 3.0'
end
Okay!
Looks like the solution in your case was to move use_frameworks! up and out of a specific target and make it global for the Podfile.
The issues you're now seeing (in your Update 2) is that you need to go into your Project Settings and fix the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES setting. I'd recommend simply removing the build setting.
Just declare the use_frameworks! line globally.
It worked for me!!!
Sample Code below :
use_frameworks!
target 'my_project' do
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
I'm trying to install an objective-c Wrapper for Jsip 'VialerSIPLib' and use it in my swift project here is my pod
platform :ios, ’10.0’
use_frameworks!
target 'EMedicalAdmin' do
pod 'ObjectMapper', '~> 2.1'
pod 'Alamofire', '~> 4.3'
pod 'SwiftyAvatar', '~> 1.0'
pod 'AlamofireImage', '~> 3.1'
pod 'Eureka', '~> 2.0.0-beta.1'
pod 'JSQMessagesViewController', :git => 'https://github.com/jessesquires/JSQMessagesViewController.git', :branch => 'develop'
pod 'PKHUD', '~> 4.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'ImageSlideshow', '~> 1.1.0'
pod 'SwiftyJSON'
pod "FlexibleSteppedProgressBar"
pod 'BTNavigationDropdownMenu', :git => 'https://github.com/PhamBaTho/BTNavigationDropdownMenu.git', :branch => 'swift-3.0'
pod 'VialerSIPLib'
end
but i get this error when installing :-
target has transitive dependencies that include static binaries:
and if i remove
use_frameworks!
from my podfile it would work but all my other swift based pods won't work
so, i'm left with using only this one pod (VialerSIPLib) or Use all my other pods except it
Please add this to your podspec: s.static_framework = true
This is available from cocoapods version 1.4.0.
It worked for me.!!
use_frameworks! should be enough but sometimes the pod.lock file gets corrupted.
So you can delete the pod.lock file and then do
pod repo update and pod install
if any one is Still wondring ,it can't be Done
Using dynamic vendored frameworks shouldn't be a problem even if the
developer isn't using CocoaPods with use_frameworks!, unless they for
some reason need a static lib, such as if building a command line
tool, where static linking is preferable.
So .You Could add the static library manually and link it in you project or wait for the vendor to Change the library into a dynamic Framework
More info here
For me this is how i solved it :-
1- Downloaded the static library using Cocoapods without use_frameworks!
2- used Carthage for Adding other libraries
3- and if a library Doesn't have a Carthage support i would do it manually (Not advised since alot of Duplicate dependencies may Appear)
I put up a repo to show how to do: https://github.com/Lucashuang0802/CocoaPodsWithCarthage
There are a couple things to do:
- install your objective-c lib via CocoaPods without indicating use_framework! in the Podfile
- install your pure Swift module via Carthage
You should be able to compile fine with this solution.
It's a weird one.
For me uninstalling and installing again worked.
Steps -
Comment(#) the error causing pod in pod file
Pod install
Uncomment the line in pod file and save
Pod install
I want to update magical record from 2.2 to 2.3.3 sdk. In my project having pod file.. so how to update magical record sdk 2.2 to magical record 2.3.3 sdk. please guide me any body.i am new to cocoa pods and pod file. Thanks in advance. in my pod file having like this
pod 'MagicalRecord', '~> 2.2'
pod 'Reachability', '~> 3.1.1'
pod 'AFNetworking', '~> 2.2'
pod 'MBProgressHUD', '~> 0.8'
This is the magical record sdk 2.3.3 updated link.
https://github.com/magicalpanda/MagicalRecord
1) Open Terminal
2) Write CD command. and Drag and Drop folder (To get a path of your project) -> press enter
3) write command open -e podfile (to add a new version)
4) close podfile . write command in terminal pod upade
That's it.
Edit 1 :-
Edit 2 :-
Step 1 :- Remove "pod 'MagicalRecord', '~> 2.3.3’ " from your pod file.
step 2:- pod update (it will uninstall magical record from your project)
Now again follow edit 1 as write again "pod 'MagicalRecord', '~> 2.3.3’ " in your podfile. and write command pod update.
Edit 3 :- Don't forget open your project from .xcworkspace file.
Note :- Before do anything first take backup of your project.
replace pod 'MagicalRecord', '~> 2.2' with pod 'MagicalRecord', '~> 2.3'
and then
open terminal
type cd -> Drag and drop your projectfolder
pod install
I followed the instruction from Cocoapods.
Below is my Podfile:
platform :ios, '8.2'
pod 'SwiftyJSON', '~> 2.1'
pod 'SwiftSpinner', '~> 0.6'
pod 'Alamofire', '~> 1.1'
pod 'SuperRecord', '~> 1.2'
pod 'Toucan
When I did pod install I got the following error:
Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add use_frameworks! to your Podfile or target to opt into using it.
Updated:
Below is my console log:
$ pod install
Analyzing dependencies
Downloading dependencies
Installing Alamofire (1.1.4)
Installing SuperRecord (1.2)
Installing SwiftSpinner (0.6.0)
Installing SwiftyJSON (2.1.3)
Installing Toucan (0.2.0)
[!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt into using it.
Add "use_frameworks!" to your Podfile:
Please see below sample Podfile
target 'MySample' do
pod 'AFNetworking', '~> 2.5'
pod 'Net', '~> 0.2' #This is a sample in Swift
use_frameworks! # <--Use this line
end
Add "use_frameworks!" to your Podfile because:
Because Apple doesn't let you build static libraries that contain
Swift. Unlike Objective-C, Apple doesn't ship the Swift standard
runtime libraries with iOS. This decouples the language version from
the platform version. When you build an app with Swift, you're
responsible yourself to ship them. By default, Xcode uses
swift-stdlib-tool to handle copying the Swift runtime dylibs, but the
tooling falls short when attempting to ship frameworks that use Swift
with an app that is Objective-C only. Your app executable and the
frameworks you ship will all use the same set of dylibs, which are
embedded into the Frameworks subdirectory of the application bundle.
First, that's because you can't link against different versions of the
standard libraries. Furthermore it is desirable to embed them only
once and not multiple times, because of constraints to memory size and
network speed, which are relevant for distribution.
You can make CocoaPods integrate to your project via frameworks
instead of static libraries by specifying use_frameworks!. If that's
not present, you won't be able to integrate dependencies, if you
depend on a pod which includes Swift source code.
Reference: http://blog.cocoapods.org/CocoaPods-0.36/
as it written in Podfile it says uncomment use_frameworks! is your are using Swift so all you have to do uncomment this line and all works just fine
# 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!
target 'YourProjectName' do
pod 'SwiftyJSON', '~> 2.1'
pod 'SwiftSpinner', '~> 0.6'
pod 'Alamofire', '~> 1.1'
pod 'SuperRecord', '~> 1.2'
pod 'Toucan'
# all other pods goes here
end
target 'YourProjectName' do
end
target 'YourProjectName' do
end
the solution is very simple. You only have to add these lines to your pod file:
target 'PassDTAFirebase' do
inherit! :complete
# Here your pods
use_frameworks!
end
I my case i used to upgrade cocoapods by command sudo gem install cocoapods and my issue got resolved. I used objective - c as well as swift libraries in my project.