Konrad Konrad - 1 month ago 19
Objective-C Question

iOS CorePlot how to install

I am trying to use CorePlot in one of my iOS projects, but even after following the instructions and looking around online, I haven't managed to correctly install the framework. I feel like the documentation has not evolved and no longer describes the correct way to install the framework.

I followed these instructions. But some things do not make sense to me, either because they are no longer current or because I don't understand.

For instance, when I am told to add the library to the "Link binaries with binary" section, the Core Plot library is highlighted in red. Then when I am told to edit the Header Search Paths, I don't understand what to do because the .xcodeproj file I dragged into my project does not have a "framework" folder.

Could anyone please give up-to-date, noob-friendly instructions?

Thank you.

Edit: I tried to install according to the instructions below (manual installation) and I am now getting three errors:

Undefined symbols for architecture x86_64:
"_vDSP_maxvD", referenced from:
-[CPTPlot plotRangeForField:] in libCorePlot-CocoaTouch.a(CPTPlot.o)
"_vDSP_minvD", referenced from:
-[CPTPlot plotRangeForField:] in libCorePlot-CocoaTouch.a(CPTPlot.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Answer

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 :

enter image description here

  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.

enter image description here

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

enter image description here

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

enter image description here

  1. Go to ViewController.m and add

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