Core-Plot: Unknown class CPLayerHostingView in Interface Builder file
Asked Answered
S

6

2

Using core-plot does not seem to be an easy integration task. Header path are already setup. In Interface-Builder I create an CPLayerHostingView which belongs to a View Controller which is instantiated by Interface Builder.

When the nib file is loaded I get the message:

Unknown class CPLayerHostingView in Interface Builder file
Spatola answered 12/3, 2010 at 7:46 Comment(4)
From the mailing list, it looks like you were able to resolve this: groups.google.com/group/coreplot-discuss/t/…Undercast
No, this is still another issue. Interface builder isn't aware of CPLayerHostingView. Maybe I should discuss this on the mailing list too.Spatola
By noew I got around that issue, by not instantiating a "PlotViewController" in Interface Builder but programmatically.Spatola
I had the same problem that @Spatola describes even after changing CPLayerHostingView to CPGraphHostingView. I found that the cause was that I had missed the step to copy libCorePlot-CocoaTouch.a to the "Link Binaries with Libraries" phase for the target. Once I fixed that the 'Unknown class' error went away.Salaidh
H
11

I found, that there are two different versions of that object. One for Mac-Only called "CPLayerHostingView", one for iPhone only called "CPGraphHostingView".

If following the poplular example at http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application you would use the following lines, if building an iPhone-App:

CPGraphHostingView *graphView = (CPGraphHostingView*)self.view;
graphView.hostedGraph = graph;
Helman answered 16/11, 2010 at 17:18 Comment(0)
Y
2

http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application

Here is the answer ..

U can see mars' answer there

"i got it to work....ok, i added the -all_load -ObjC flag in the Target>Settings....I think this is where everyone gets confused...There are 2 places where to put the other link and header search paths, in Project Settings and in Target Settings.."

So solution is

Add -all_load -ObjC in Project settings and target settings

Yalu answered 10/6, 2010 at 7:7 Comment(0)
A
2

I had to rename CPLayerHostingView to CPGraphHostingView to get this to work after upgrading to the latest version of core plot (along with iOS 4 and the upgrade of XCode).

Authoritative answered 23/10, 2010 at 11:29 Comment(0)
R
1

I think you're saying that you get this error when you load the NIB file in your app's code. In that case, the error suggests that you haven't built the Core Plot classes into your application (iPhone) or linked against the CorePlot framework and copied into the app bundle's Frameworks/ directory (OS X).

Relieve answered 12/3, 2010 at 16:45 Comment(2)
I added the core plot xcode project as a dependency. The library is linked correctly....Spatola
Is the CorePlot framework also being copied into the app bundle's Frameworks/ directory via a "Copy Files" build phase?Relieve
S
1

CPGraphHostingView thank u it worked for me aswell; 3 imp things 1>perform settings for both project target aswell as application target.(make sure configuration is all configuration) 2>give correct header search path for framework library 3>learn over it::::::-)

Septenary answered 25/10, 2010 at 14:36 Comment(0)
R
0

For whatever it is worth. Followed tutorial: http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application and ended up having that same error. I looked into the CorePlot framework folder and did not find that CPLayerHostingView there, but found CPGraphHostingView inside iPhoneOnly folder. Changed CPLayerHostingView to CPGraphHostingView in IB and error disappeared. So, check what is in yours and use it. May work.

Rimma answered 2/11, 2011 at 15:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.