どこでエラーになってるのかはデバッガーを見ればスグにわかるが
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
hostingView.collapsesLayers = NO; // Setting to YES reduces GPU memory usage, but can slow drawing/scrolling
hostingView.hostedGraph = graph;
という感じで、hostingViewをいじってる所で落ちているのがわかる。
hostingView.collapsesLayers = NO;
そもそも、下のようにCastするにはself.viewのClassがCPTGraphHostingView
であることが前提のコードなってる。
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
なので、XibでViewを作ってるなら、CPTGraphHostingView
をClassに適応するか普通にCPTGraphHostingViewのインスタンスをViewとして使うように変更すればよい。
CPTGraphHostingView *hostingView = [[[CPTGraphHostingView alloc] init] autorelease];
hostingView.collapsesLayers = NO; // Setting to YES reduces GPU memory usage, but can slow drawing/scrolling
hostingView.hostedGraph = graph;
[self setView:hostingView];// self.viewをhostingViewにする
これでタイトルのエラーは出なくなる。