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
Sney
  • 2,486
  • 4
  • 32
  • 48
  • From the mailing list, it looks like you were able to resolve this: http://groups.google.com/group/coreplot-discuss/t/ef486630d813e3d6?hl=en – Brad Larson Mar 12 '10 at 13:39
  • No, this is still another issue. Interface builder isn't aware of **CPLayerHostingView**. Maybe I should discuss this on the mailing list too. – Sney Mar 12 '10 at 16:21
  • By noew I got around that issue, by **not** instantiating a "PlotViewController" in Interface Builder but programmatically. – Sney Mar 13 '10 at 09:32
  • 1
    I had the same problem that @Sney 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. – lambmj Mar 08 '11 at 20:38

6 Answers6

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;
nodepond
  • 501
  • 6
  • 24
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

S.P.
  • 5,427
  • 11
  • 56
  • 83
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).

David Conlisk
  • 3,387
  • 4
  • 33
  • 39
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).

Barry Wark
  • 107,306
  • 24
  • 181
  • 206
  • I added the core plot xcode project as a dependency. The library is linked correctly.... – Sney Mar 13 '10 at 09:31
  • 1
    Is the CorePlot framework also being copied into the app bundle's Frameworks/ directory via a "Copy Files" build phase? – Barry Wark Mar 13 '10 at 16:55
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::::::-)

pintu
  • 11
  • 1
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.

Boris Gafurov
  • 1,427
  • 16
  • 28