Using CocoaPods for the “Charts” framework. Swift 2

旧巷老猫 提交于 2020-01-03 06:04:07

问题


I am a newbie when it comes to CocoaPods so please bear with me! I am looking at the tutorial (https://www.raywenderlich.com/97014/use-cocoapods-with-swift) however this is using the dependency "pod 'Alamofire', '2.0.2'". I have looked online for over a hour now and I can't find what to use for the Charts framework (https://cocoapods.org/?q=charts).

So Far i have done the following steps:

1.

sudo gem install cocoapods 

and got the following output:

2.

pod setup --verbose

and got the following output:

3.

open -a Xcode Podfile

and got the following result :

4.

Uncommented "use_frameworks!" and uncommented "platform :ios, '6.0'" and changed it to "platform :ios, '9.0'"

Now i am stuck as i don't know what dependancies i need to use for the charts framework. Apologies if this is a very simple answer!

Thanks in advanced for your help :)

EDIT: After installing the pod files i dragged the 'Charts.xcodeproj file into my project.

When i try and embed binaries i have various options:

When i add them and build i get the following errors:


回答1:


Hey First you have to decide which chart library You want to use. Something like this https://github.com/danielgindi/ios-charts

for above chart library you have to use

pod 'Charts'

in your pod file inside the project .

Now your pod file will be something like this

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Charts'

Now open the terminal and go to your project directory and enter the command

pod install

and you are good to go. Hope this help you.




回答2:


Usually there are instructions on what CocoaPod name to use for installation on the GitHub or source code hosting page of the library.

After a pod install command under your correct project directory, you need to exit out of your .xcodeproject and open up the workspace file. This is what you do from now on after a project has a cocoapod dependency. The workspace now contains both your project, and the pods project as a package manager. The pod(s) you installed are there, and must be accessed by importing the name of the CocoaPod (can be seen in folder drop down view in the Pods project).

You do not need to drag anymore files in your own project or embed like before. Make sure to delete those.

If you're still having trouble, can you edit what your current podfile looks like?



来源:https://stackoverflow.com/questions/36305216/using-cocoapods-for-the-charts-framework-swift-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!