iOS CorePlot how to install
Asked Answered
P

3

2

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)
Plainspoken answered 30/1, 2015 at 12:55 Comment(4)
Probably, this will help you : raywenderlich.com/13269/…Culch
The Core Plot repository moved to GitHub. The updated installation instructions are on the wiki.Tsaritsyn
I read them, I just can't manage to make it work because I am just not used to installing these things, I suppose...Plainspoken
I have posted the correct solution for the problem you were facing and a link with more details about the problem please check and verify my answer.Bovine
C
11

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 !

Cold answered 30/1, 2015 at 13:29 Comment(5)
Thank you very much for your very thorough reply. I did everything you said. Just to make sure, the folder I copied into my workspace was the "framework" folder, it contains the header files, the cocoa XCode Project and all the .h and .m files within the "Source" subfolder. I get three errors related to the Header Search Paths. Please see my question for details. Thanks a lot.Plainspoken
You copied the right folder, don't worry about that ;) My example is made for the 1.5.1 release, but using the 2.0 release i got the same errors. According to github.com/core-plot/core-plot/issues/76, you have to add the Accelerate framework, and it will compile fine. You can do following my example, step 4, 'link binary with libraries', and search for 'Accelerate'Lynden
Hi, I still get a 'Core-Plot-CocoaTouch.h" file not found when I try to import the header file. I notice that my libCorePlot-CocoaTouch.a is highlighted redCopt
Nevermind, not sure what changed, but it's working. Thanks for the great answerCopt
@Momo Im having same problem! :-\Lampas
I
4

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)

Instinct answered 30/1, 2015 at 13:12 Comment(0)
U
0

@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...

Unholy answered 4/11, 2017 at 23:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.