views:

44

answers:

2

HI i am using core plot i am getting an

"'*** -[UIView setHostedLayer:]: unrecognized selector sent to instance 0xf283a0'" 

error in the line

hostingView.hostedLayer = graph;
A: 

You hostingView has to be a CPLayerHostingView, not a generic UIView. Make sure it is specified correctly in Interface Builder or in your setup code if you're creating it manually.

Eric Skroch
A: 

Hello codaddict,

I had this problem too! I just figured out the solution: you need to open up the xib file for your view controller class, the one where you setup the pie chart, and in there you will need to select the view, then make the view a CPLayerHostingView type. If you're unsure how to do this, go to the "Identity Inspector" window, and under Class Identity (the first item in the Identity Inspector window, enter CPLayerHostingView for the "class" value. When you do this, the view will then be labelled as "Layer Hosting View". Save and close the .xib, then go back to Xcode and build. It should work at that point.

Sorry if this way is extraneous and there is a better way, but this is how I finally got it to work. Hit me up if you have any further questions or need more explanation. Good luck!

Andy

andyengle