iOS CorePlot how to install

北战南征 提交于 2019-12-03 20:46:18

Foundry's answer is great if you use Cocoapods, but I'll will provide you a step-by-step guide to do it manually :

  1. Create a folder named Workspace, and create a new "testCoreplot" project in it from within Xcode.
  2. Download CorePlot, and copy the "Source/framework" folder into your workspace folder. Rename it "CoreplotFramework" in order to avoid issues if you add others frameworks this way later.

You should have this :

  1. Launch your testCoreplot project, and drag the file "CorePlot-CocoaTouch.xcodeproj" from the finder in it.
  2. Selet the testCoreplot target, go to 'Build Phases" tab, and add "CorePlot-CocoaTouch" in "target dependencies" section and "libCorePlot-CocoaTouch.a" in "Link Binary With Libraries" section. Add the Accelerate framework too for release 2.0.

  1. Go to "Build settings" tab, look for "Header search paths" and add $(SRCROOT)/../CoreplotFramework . Be sure you select recursive .

  1. Still in this "build settings" tab, add the -ObjC flag

  1. Go to ViewController.m and add

    #import "CorePlot-CocoaTouch.h"
    
  2. Compile, everything should be right !

Core Plot provides a podspec, so you can use cocoapods as your library manager which should make installing and updating much simpler

  1. Install cocoapods on your system
  2. Add a text file to your project called Podfile
  3. In the Podfile add the line pod 'CorePlot', '~> 1.5'
  4. In the terminal, cd to your project directory and run pod install

Cocoapods will generate a xcworkspace file, which you should use for launching your project (the .xcodeproj file will not include the pod libraries)

@foundry's answer is what worked best for me. All other things I tried triggered lots of weird issues.

This is how I did it: At the root of the directory project, create a plain text file named Podfile (no txt extension), then add the following to it:

target 'App Name' do pod 'CorePlot', '~> 2.2' end

with App Name being your App name, i.e. MyApp.xcodeproj, then just use MyApp.

Then, from your terminal, run pod init, followed by pod install. After this, from Finder, don't run the original MyApp.xcodeproj anymore, but the newly created MyApp.xcworkspace.

It just worked like a charm...

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