How to install CorePlot framework correctly? - objective-c

I want to use CorePlot.framework in Mac OS X. However, I cannot install it correctly though it has costed me several hours.
I downloaded it (0.4 version) from google host site, and have tried to put CorePlot.framework in "/Library/Frameworks/" or some other custom places.
I also have added it into "link binary and libraries". unfortunately, the compiler always cannot find "" .
Any one who have some experience can give me some advice to install and use it?

If you check the readme files, you can find the instructions as follows:
Copy the CorePlotHeaders to your Xcode project
Copy libCorePlotCocoaTouch.a to your Xcode project
Add to Other Linker Flags in your target build settings: -ObjC -all_load
Add the QuartzCore framework to the project.
To follow these instructions, create a new blank project and copy the folder (drag and drop) CorePlotHeaders into Xcode. When prompted, be sure to check "copy these files/folders to the source directory".
Next drag the libCorePlayCocoaTouch.a library in the same manner (again, select the checkbox). You should now have the .h files and the .a included in your project.
Now, select your project and choose the "Target" and in the 3rd tab "Build Settings" search for "Other Linker Flags" and add -"ObjC -all_load" without quotes.
Finally, add the QuartzCore framework to your project and you're done.
I've been working with CorePlot today and am rather impressed with it so far. It's not 100% comprehensive but it's good enough for what we need. If you get stuck, be sure to follow the readme instructions and double check everything is setup as needed. I didn't struggle with getting it set up unlike some other libraries so hopefully you should be able to get sorted with minimal fuss :)

Related

How do I include Scintilla in an XCode 3.2.5 project?

I downloaded Scintilla, built and ran ScintillaTest. That worked (almost) fine. Now, I want to include Scintilla in a new project, but can't seem to figure out how to. I tried ctrl-clicking my target and selecting Add Existing Framework..., then Add Other... and finally file located at scite337/scintilla/cocoa/ScintillaFramework/build/Release/Scintilla.framework (obviously I omitted the first part of the path).
After I did this I just added an #import statement in the AppDelegate of my further untouched new project. Upon hitting Cmd+R it says ScintillaView.h: no such file or directory...
I thought that if I added the framework to my only target it would pass the location of the header files to the compiler (and preprocessor). Obviously it doesn't, so I assume I'll have to add the paths of the header files (and maybe other files) to the Build Settings, but there are lots of Build Settings, so I don't have a clue where.
If you don't have access to XCode 3.2.x, please leave how you'd do it in a newer version. I've found a lot of information on other XCode matters for higher versions did that work well in XCode 3.2.5 too (with a little bit of searching for menu items and settings panels).
By looking at the ScintillaTest XCode project I discovered how it works: you have to import the XCode project called ScintillaFramework, which is the file named ScintillaFramework.xcodeproj (obviously). But that isn't enough, after that XCode still can't find the header files in the framework. I looked at the build settings in the ScintillaTest project and found 'Header Search Paths' set to ../../. Setting this failed in my project, it had to be one directory less back: ../. No I just need to get the compiler to accept the C++ constructs in the Scintilla framework.
Update:
Strangely, this stopped working. I do not understand it either. So I just right-clicked my target, from there: add existing framework...->add other...->[browse to ScintillaFramework/build/Release/Scintilla.framework]. This works partially, see my newest question.

106 duplicate symbols for architecture armv7

Working on my iPhone app and trying to build for debug and I get "106 duplicate symbols for architecture armv7"?
I am using the .workspace file because I am trying to use CocoaPods. If I don't use the .workspace and instead use the .xcodeproj I don't get the error, but then I get missing -lPods .
In my project I have the following targets in the Project Navigator.
Pods (blue icon)
MyProject (blue icon)
Restkit.xcodeproj (blue icon)
... all my files
The issue is that Restkit is making reference to "AFHTTPClient.h" and all the other AF code, but I included it via CocoaPods. I tried deleting the AFNetworking folder from the RestKit library, but apparently the Restkit library can't find the Pods version of AFNetworking?
Is there a way to get RestKit to use the Pods version? If not how do I go about removing Pods from my project?
There is a line in one of your .h files where your wrote
#include "___.m"
instead of
#include "___.h"
So I fixed it. After removing the RestKit version of AFNetworking, from the vendor folder, I added it back by dragging into Xcode. It asks which project I want it used/copied to and this time I selected RestKitTest (or whatever the RestKitTesting is named). It works now. Maybe I selected both RestKit and RestKitTest before, which was wrong?
I also came up with same error. Generally this kind of error occurs due to duplicate classes and xibs in project folder. For Example in my project I had these classes twice ServiceRequest.h/.m. Get rid of duplicate ones and you are good to go.
In Build Phases -> Compile Sources, make sure you don't have the same file added twice.
"Duplicate symbols for architecture" issue occurs in two situations:
You added a .m file twice into your project
You're using a static library (.a file) which already includes some classes that you include into the project.
For fixing any of those cases, check the linker error and look for the .o files that are duplicated (sample: Reachability.o).
Then go to the build phases -> compile sources and search the specified files, if any one appears twice delete one of them, if only appears once it means that the file is also included in one of the static libraries added to your project. Delete it from your list of sources to be compiled and try again.
I saw this error when, I did drag and drop my calabash framework onto xcode and selected add to targets option in the window thats shown. Basically there were two references to files added
I had to remove the calabash framework manually
Right way of doing it
copy to calabash framework to project directory
then go to xcode project
Choose target -> Build phases -> Link Binary With Libraries and add the frame work using + button
I have noticed that duplicate symbols are caused for Google analytics after installing cocoaPods as well. Once I removed one of archives, either libGoogleAnalytics_debug.a or libGoogleAnalytics.a duplication has gone. But obviously if I removed debug one I will not be able to run os simulator and vica versa. I know its not the solution, but at least it could give an idea what could be a solution. Will come back to this thread if I will figure out how to have both a files in this case.
Edit:
I was able to solve the issue by upgrading from G analytics version 2 to 3. It has only one library file and I guess this is the reason why we don't get duplicated symbols anymore. I hope it makes sense.

How do you add GPUImage to an iOS project?

I am trying to make a camera/photo app that will add a filter on an image. I have heard of Brad Larson's GPUImage and so I downloaded it and tried to manipulate it to be more familiar with the code.
Now, I made a new project in Xcode and added it on my frameworks, but i don't have any idea how to use it on a new project.
How can I properly use GPUImage in my new project?
I don't know how I could be much clearer than the step-by-step instructions I put on the very first page of the GitHub project and in the README.md under the section "Adding the framework to your iOS project":
Once you have the latest source code for the framework, it's fairly
straightforward to add it to your application. Start by dragging the
GPUImage.xcodeproj file into your application's Xcode project to embed
the framework in your project. Next, go to your application's target
and add GPUImage as a Target Dependency. Finally, you'll want to drag
the libGPUImage.a library from the GPUImage framework's Products
folder to the Link Binary With Libraries build phase in your
application's target.
GPUImage needs a few other frameworks to be linked into your
application, so you'll need to add the following as linked libraries
in your application target:
CoreMedia
CoreVideo
OpenGLES
AVFoundation
QuartzCore
You'll also need to find the framework headers, so within your
project's build settings set the Header Search Paths to the relative
path from your application to the framework/ subdirectory within the
GPUImage source directory. Make this header search path recursive.
To use the GPUImage classes within your application, simply include
the core framework header using the following:
#import "GPUImage.h"
As a note: if you run into the error "Unknown class GPUImageView in
Interface Builder" or the like when trying to build an interface with
Interface Builder, you may need to add -ObjC to your Other Linker
Flags in your project's build settings.
Also, if you need to deploy this to iOS 4.x, it appears that the
current version of Xcode (4.3) requires that you weak-link the Core
Video framework in your final application or you see crashes with the
message "Symbol not found: _CVOpenGLESTextureCacheCreate" when you
create an archive for upload to the App Store or for ad hoc
distribution. To do this, go to your project's Build Phases tab,
expand the Link Binary With Libraries group, and find
CoreVideo.framework in the list. Change the setting for it in the far
right of the list from Required to Optional.
Additionally, this is an ARC-enabled framework, so if you want to use
this within a manual reference counted application targeting iOS 4.x,
you'll need to add -fobjc-arc to your Other Linker Flags as well.
To see this in action, look at any of the many sample applications I ship with the framework.
Please read this page http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework and this: https://github.com/BradLarson/GPUImage
Note: Simply, you can copy all source code files in framework/source folder to your project, and import GPUImage.h to use.
Regards!
Here's how to do it in Swift 5 in Xcode for iOS with Visual Directions:
Two things before you begin.
you should start this process on a copy/duplicate of your project until you get it correct (it took me several tries), or even start with a new project. If something goes wrong you want to keep your original project intact
if you have a project open with the GPUImage in it that you are trying to copy, make sure to close it first. You will get an error saying that there is a project with it already open
1- go to the GPUImage gitHub page
2- in the upper right hand corner, click the green Code button and then click Download Zip
3- in your current Xcode project (the one that you want to use GPUImage) click the first folder underneath the blue project icon
4- after that go to the top of Xcode and click File > Add Files to "yourProject"
5- when the new window appears go to Downloads (or wherever you downloaded GPUImage in the second step) > GPUImage3-master > framework > GPUImage.xcodeproj and then click Add. It's important that you make sure Copy Items if Needed and Create groups are checked.
6- you will now see GPUImage.xcodeproj inside your Xcode project underneath that same folder from step 3 (no need to do anything with it)
7- click your main project's blue project icon > Build Phases and the middle/center pane should be on TARGETS. Make sure you DON'T click the GPUImage.xcodeproj, that is the WRONG folder
8- while still under Build Phases click Dependencies then click the plus sign
9- when the pop up appears select GPUImage_iOS then select Add (make you sure you pick the iOS version and not the macOS version)
10- you will now see the GPUImage_iOS dependency under Dependencies (no need to do anything here)
11 -now while still under under Build Phases click Link Binary with Libraries then click the plus sign
12- when the pop up appears under Workspace > GPUImage > select GPUImage.framework from 'GPUImage_iOS' target ... then press Add (make sure you select the iOS version and not the macOS version)
13- now the library is linked (no need to do anything here)
14(a)- This is important, if underneath Build Phases there isn't a Copy Files folder than go to the top of Xcode and select Editor > Add Build Phase > Add Copy Files Build Phase. If the folder is already there I'm not sure what to do if the folder already exists. The Copy Files folder wasn’t initially there for me and I had create it using step 14(b). I would assume if it’s already there just open it and continue to step 16
14(b)- if for some reason Add Copy Files Build Phase is grayed out, do this or under Build Phases, in the upper left hand corner press the plus sign, then select New Copy Files Phase
15- now you will see a brand new Copy Files directory underneath Build Phases
16- if Copy Files isn't already open, press the toggle button to open it and next to Destination change Resources to Framework
17- while still under Copy Files, press the plus sign, when the pop up appears, if this is an iOS project, under Products, select the top GPUImage.framework and press Add. This last step is under Brad's directions
Add a new Copy Files build phase, set its destination to Frameworks,
and add the upper GPUImage.framework (for iOS) or lower
GPUImage.framework (for Mac) to that
18- now the GPUImage.framework has just been added to Copy Files
19- your Build Phase screen should look like this
20- clean the project Shift+Command+K
21- in whatever file you intend on using the GPUImage in go to the top and enter import GPUImage (it should start to appear under autocomplete) then build your project.
22- test to see if a Class and a Method from GPUImage works inside your project
// nothing is supposed to actually happen here, just test to see if the SmoothToonFilter() class and filterWithOperation() method are recognized without any errors
let testImage = UIImage(named:"some_image_from_your_assets")!
let toonFilter = SmoothToonFilter()
let _ = testImage.filterWithOperation(toonFilter)
Done!
Probably the simplest of all ways of integrating GPUImage into your project is via cocopods. And while the GPUImage CocoaPods repo isn't actually maintained by Brad, it's upkeep is pretty regular, and it makes integration a breeze.
> Go get it

Adding .c files to xcode

I'm trying to add the hypen library to my Xcode iOS project and it has 4 files: hyphen.c, hyphen.h, hnjalloc.c, hnjalloc.h. I dragged them to my project and hit build, but I'm getting undefined symbols for architecture i386 errors. Am I supposed to take any other steps besides dragging them to my project?
Make sure you've added them to the build target - including a file into the project without including in the build target can easily cause this error.
right click on the Source folder (top left where all the folder are) and check add. Then choose the files you wish to add. I tried drag&drop had problems with linker.

Adding a static library to an XCode 4 project breaks "build and archive" feature

I built a static library with MGTwitterEngine and some OAuth / TouchJSon libs.
Then I added that within the main XCode proj of an app.
I'm having trouble with this feature of XCode (build and archive). After I added the libs, the "build and archive" no longer generates a .IPA
Do you know a good tutorial to make some proper use of this archive feature ?
What should I do within the XCode Projet to make sure it will work correctly with my static libs ?
ps: The second is the most important to me.
Thanks in advance ;)
You should change your static library's "Build Settings", make sure Skip Install is set to YES
If still not work, check your static library's "Build Phases", make sure:
After that, your Archive should be OK.
But if your Xcode start to report who can not find your static library's .h files, you can just add them into your project as references, or change your project's "Build Settings", let it find your .h files in your static library's folder.
According to the Apple engineers, you should not use the "Copy Headers" build phase with static libraries on iOS - it's only intended for dynamic libraries (oddly using "Copy Headers" works fine for most cases, but definitely breaks the 'Archive' case).
Instead add a "Copy Files" build phase, setup like this:
If you are using the static libraries template, this build phase should already be present.
Drag all the header files that should be exposed into this section.
You also need to see "Skip Install" for the library to yes as other people have answered.
The video for WWDC 2012 Seassion 408 "Working with Schemes and Projects in Xcode" covers this from timestamp 45:18.