Using Core Plot 2 in an Xcode 5 project - ios

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?

Here are some current steps to follow to add the static Core Plot library to your project:
download the latest version of CorePlot here
navigate to the CorePlot framework folder and run CorePlot-CocoaTouch.xcodeproj
build (not run) the CorePlot-CocoaTouch.xcodeproj project
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
back in Xcode highlight the CorePlot-CocoaTouch project
click Product > Scheme > select Universal Library (selects which target to build)
build project again (not run)
go BACK to your CorePlot download folder > build > Release-universal and you will see the CorePlotHeaders folder and libCorePlot-CocoaTouch.a are both available
open the Xcode project you would like to add static CorePlot to
add the CorePlot > build > Release-universal > CorePlotHeaders folder and libCorePlot-CocoaTouch.a files to your project (selecting 'copy items into destination group's folder)
select your Project and in the 'Linking' section find 'Other Linker Flags' and add -ObjC
from your Target > Build Phases > Link Binary With Libraries add the QuartzCore framework to your project
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!

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.

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)

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

Related

MyClass is unavailable: cannot find Swift declaration for this class

I am building a custom framework in swift.I have builded the framework for all the architecture. I am using Debug-Universal build in my sample app. Now when I run the app, It works fine in the simulator but while running on the device, I am getting the error Breeze is unavailable: cannot find Swift declaration for this class
When I am using Release-Universal it is giving No such Module BreezeSDK
Follow these steps after creating the universal binaries:
Before lipo, you are building .framework packages for the individual architectures.
For each package:
Traverse to abc.framework/Modules/abc
Copy files .swiftdoc
Go into universal abc
Traverse to abc.framework/Modules/abc
Paste the files you copied in step 2
Repeat these steps for all architectures.
Finally your universal framework package path abc.framework/Modules/abc.swiftmodule/ should contain
those files:
arm.swiftdoc
arm.swiftmodule
arm64.swiftdoc
arm64.swiftmodule
i386.swiftdoc
i386.swiftmodule
x86_64.swiftdoc
x86_64.swiftmodule
The Swift compiler needs swiftmodule map files for each architecture.
Follow these steps
Download Bareeze SDK.
Drag and add Breeze.xcodeproj to your project.
Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
In the tab bar at the top of that window, open the "General" panel.
Click on the + button under the "Embedded Binaries" section.
Select the top Breeze.framework
Hope this might solve the issue.

Xcode 6: No Frameworks Folder in Project Navigator

I am using Xcode 6 and following an Xcode version 4 tutorial so things are different here and there.
There doesn't seem to be a Frameworks folder in my project navigator and so when I downloaded some .framework files and added them manually in the build phase of my project editor, I had no Frameworks folder to save them in and just let them fall into the top of my project navigator. So they are there, just not in a special folder, and it doesn't look good.
So should Xcode 6 have a frameworks folder automatically, or do I need to create one myself? And if so, how can I do that? (I've only added new files so far).
In Xcode 6, the Frameworks folder is not added by default. You can drag and drop your .framework files into the project navigator (tick 'Copy items if needed'), then select them all > right click > "New Group from Selection" and name the folder 'Frameworks'.
Also, make sure the frameworks are added into the Project > Build Phases > Link Binary With Libraries. If not, drag them there from your newly created 'Frameworks' folder.
In short, no, you shouldn't need to create a Frameworks group yourself as Xcode is doing stuff automatically for you...
Apple are slowly, gently pushing developers in the direction of newer Clang features with the goal of making native iOS development more approachable for newbies who don't have previous experience of compiling and linking with C-based languages.
You'll find that Objective-C projects created with Xcode 6 have new build settings enabled by default including Link Frameworks Automatically (CLANG_MODULES_AUTOLINK) and Enable Modules (C and Objective-C) (CLANG_ENABLE_MODULES).
Suggested reading:
Modules (Clang documentation)
#import vs #import - iOS 7 (excellent Stack Overflow answer)
I found the other answers too confusing (where am I supposed to get .framework files?)
It's way simpler in Xcode 6. Just go to Capabilities and turn Maps on. That's it... really.
I would recommend using drag and drop feature to move files into Xcode. Xcode show you the Choose options for adding these files window [Copy items if needed] [Added folders]
For example Xcode can automatically add relative path ($(PROJECT_DIR)/) to:
Build Settings -> Library Search Paths if you drag and drop a library
Build Settings -> Framework Search Paths if you drag and drop a framework

Adding Cocos2d (2.0) to existing iPhone Project

(Posting for reference purpose only. So I will answer right away)
I used Cocos2d 2.0 on Xcode 4.6.3.
I faced a 'Lexical or Preprocessor issue' about kazmath/SomeFile.h file not found.
Looked around but could find only outdated questions.
I added Cocos2d to iPhone project and will discuss the steps i have taken so that it can help people looking for doing this and facing issues...
I will point out the steps that I have taken , so someone can take a look
Step 1.
Create a test project in Cocos2d and find the “libs” folder in finder, and then just copy it into your project’s folder in finder. Then from finder, drag-and-drop the “libs” folder into Xcode’s “Project Navigator” sidebar and check the “add files to destination”.
Step 2.
In Project > Targets > Build Phases > Link Binaries with libraries > Hit the + and Check if following frameworks are there if not add them:
AVFoundation.framework
GameKit.framework
CoreText.framework
AudioToolbox.framework
OpenAL.framework
QuartzCore.framework
CoreGraphics.framework
UIKit.framework
Foundation.framework
OpenGLES.framework
Step 3.
In Project > Targets > Build Settings > Search Paths > Header Search Paths
Add (quotes included) this
“(your Project's folder name in finder)/libs/kazmath/include”
Step 4.
In Project > Targets > Build Phases > Link Binaries with libraries > Compile Sources
Select all files except classes that are your project already and hit enter and add the Compiler Flag -fno-objc-arc.
By doing that, hopefully all the Cocos2D files are now ARC-disabled.
Try to Build at this moment….
If there are issues then continue
Step 5.
Go to Project > Targets > Build Settings > Linking > “Other linker flags”
Add -lz and -ObjC .
Build again to check any issue still exists…
Step 6.
Go to Project > Targets > Build Settings >Search Paths > User Header Search Paths
Add this
./(your Project's folder name in finder)/libs/kazmath/include
Now try to build.. The issues might have gone by now.
I got help from the Coco2d forum and would like to thank the forum members..
Cocos2d Forum Thread
I am a newbie in programming, so please don't be rough on me if there is any mistake.

Using box-api in an ARC project?

How can I use the box-api in a project using ARC?
I copied the SDK folder to my project and added them, but I can't build my project since it uses ARC.
You have to disable ARC for these files:
Go to Your Project > Your Target > Build Phases
Select all Box files, press Enter and insert "-fno-objc-arc" without quotas
Clean and Build! ;)

CorePlot in iOS

Till now, I have been using google charts and UIWebView to show graphs in my iPhone application.
I would like to start using CorePlot so that I do not need to be dependent on the internet connection to show my graphs. However, I am lost on how to use CorePlot for my applications.
Would someone be able to help me out with how I should use CorePlot?
Check this tutorial featured by google code's site: http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application
And this instructions are worth reading too: http://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications
Hope it helps!
Many will be able to help you, but you'll have to start doing something first :) Did you check their wiki?
Look through the example apps included with Core Plot. The Plot Gallery app (available for MacOS, iPhone, and iPad) shows examples of all of the supported plot types and demonstrates many Core Plot features.
The official Core Plot documentation is out of date (on the wiki, on the google code site, AND the read me information downloaded with the project from github...).
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!

Resources