Using Core Plot 2 in an Xcode 5 project
Asked Answered
S

4

10

I'm using the instructions here to integrate Core Plot into my iOS Xcode 5 project and am having no end of issues.

I tried using the Static Library Install but it seems this refers to 1.4 as there is no directory called CorePlotHeaders though if I try to use 1.4 I run into runtime issues.

I've then tried to drag the CorePlot-CocoaTouch.xcodeproj as described in the Dependent Project Install but this only copies it as if its a file and not the whole project.

Is there more current instructions for using it as a static library or how am I copying the project incorrectly into my project?

Sponsor answered 31/1, 2014 at 23:17 Comment(0)
A
5

If you want to use the static library, build it using the "Universal Library" target. This will put the static library and the CorePlotHeaders folder in the build folder inside your Core Plot directory.

To use the dependent project, drag the project file from the Finder into Xcode under your app project in the browser pane at the left side of the Xcode window. Remember to set the "Header Search Paths" in your app build settings or it won't be able to find the Core Plot headers.

Anamorphosis answered 1/2, 2014 at 0:46 Comment(2)
The Universal Library failed to build using the latest Coreplot (10/28/14) and Xcode 6.1Spenserian
See comments in the post below (the one with the steps). The build-process searches /framework/build instead of /build. You can simply copy the outter /build-Folder after you tried it once and paste it's content into /framework/build. Then it compiles and you can use it :)Eltonelucidate
W
27

Here are some current steps to follow to add the static Core Plot library to your project:

  1. download the latest version of CorePlot here

  2. navigate to the CorePlot framework folder and run CorePlot-CocoaTouch.xcodeproj

  3. build (not run) the CorePlot-CocoaTouch.xcodeproj project

  4. navigate back to your CorePlot download folder > build > Debug-iphoneos and verify libCorePlot-CocoaTouch.a has been created. If not, unzip the download and repeat steps 1-4

  5. back in Xcode highlight the CorePlot-CocoaTouch project

  6. click Product > Scheme > select Universal Library (selects which target to build)

  7. build project again (not run)

  8. go BACK to your CorePlot download folder > build > Release-universal and you will see the CorePlotHeaders folder and libCorePlot-CocoaTouch.a are both available

  9. open the Xcode project you would like to add static CorePlot to

  10. add the CorePlot > build > Release-universal > CorePlotHeaders folder and libCorePlot-CocoaTouch.a files to your project (selecting 'copy items into destination group's folder)

  11. select your Project and in the 'Linking' section find 'Other Linker Flags' and add -ObjC

  12. from your Target > Build Phases > Link Binary With Libraries add the QuartzCore framework to your project

  13. if libCorePlot-CocoaTouch.a is not in your Link Binary With Libraries list drag it from where you copied it to your project to the Library list to add it.

You should now be able to

#import "CorePlot-CocoaTouch.h" 

(autocomplete) to the viewController that you will be using to manage your CorePlot.

If you are following old documentation on how to use CorePlot be aware that the new prefix is CPT (not CP, adjust accordingly)

Happy coding!

Windjammer answered 27/5, 2014 at 23:28 Comment(13)
Thanks for awesome answer. I followed above steps & successfully resolved the issue..Indictment
SWEET! I'm super glad to hear you won't die ^_^Windjammer
I am using latest Coreplot lib from github and xcode 5.1.1 and i am getting following error at step 7...fatal error: lipo: can't open input file: /Users/administrator/Desktop/core-plot-master/framework/build/Release-iphoneos/libCorePlot-CocoaTouch.a (No such file or directory)Somerville
@VnyKumar please review step 4 and ensure the path you're trying to open matches the directory you've unzipped to. You may have to repeat steps 2-3.Windjammer
I'm having the same problem. In step4 I get core-plot/build/Debug-iphoneos/libCorePlot-CocoaTouch.a, looks okay, but when I switch to the Universal library scheme I get an error: fatal error: lipo: can't open input file: /core-plot/framework/build/Release-iphoneos/libCorePlot-CocoaTouch.a (No such file or directory). Shouldn't it go to /core-plot/build/ instead of /core-plot/framework/build/?Wolsky
I could build the library copying the folders /core-plot/build/Release-iphoneos/ and /core-plot/build/Release-iphonesimulator/ into /core-plot/framework/build.Wolsky
Using latest Coreplot (10/28/14) and Xcode 6.1 - Also fails to build Universal Binary (Step 7). I found the following useful as a workaround: lipo -create Release-iphoneos/libCorePlot-CocoaTouch.a Release-iphonesimulator/libCorePlot-CocoaTouch.a -output libCorePlot-CocoaTouch.a With the output being a universal library.Spenserian
@JeremyC. after implementing your workaround to build a Universal Binary have you been able to successfully utilize the rest of the documented steps?Windjammer
@NateBerman- Yes, once I used the command line 'lipo -create ...' to build the universal library, I was able to continue with the procedure steps and link CorePlot into my project.Spenserian
What else you can do if step 7 failed. Step 1: Replace the "build" folder at core-plot/framework/build with the "build" folder at core-plot/build. Step 2: retry step 7.Brottman
I was getting link errors and found that I also need to add the Accelerate framework.Apologetics
@jayallengator please edit / update the post with your findings to help future readers :)Windjammer
Those were just about the best instructions I've ever read. Great job.Rectify
A
5

If you want to use the static library, build it using the "Universal Library" target. This will put the static library and the CorePlotHeaders folder in the build folder inside your Core Plot directory.

To use the dependent project, drag the project file from the Finder into Xcode under your app project in the browser pane at the left side of the Xcode window. Remember to set the "Header Search Paths" in your app build settings or it won't be able to find the Core Plot headers.

Anamorphosis answered 1/2, 2014 at 0:46 Comment(2)
The Universal Library failed to build using the latest Coreplot (10/28/14) and Xcode 6.1Spenserian
See comments in the post below (the one with the steps). The build-process searches /framework/build instead of /build. You can simply copy the outter /build-Folder after you tried it once and paste it's content into /framework/build. Then it compiles and you can use it :)Eltonelucidate
C
1

Use Cocoapod to install the necessary libraries instead of this manual step if you want to solve this problem in 1 minute ... (follow this link and go to the last thread: iOS CorePlot how to install)

Clichy answered 8/3, 2015 at 5:6 Comment(0)
B
0

As well as the steps above, you need to include -all_load in linker options, otherwise it won't work on Xcode 7.1.1

Bonnie answered 19/1, 2016 at 11:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.