2013-10-08 47 views
2

我有一個iOS7應用程序,我試圖將CorePlot 1.4集成到(依賴項目安裝)中。CorePlot在iOS7應用程序中拋出異常app/Xcode5

@property (nonatomic) CPTGraphHostingView *hostingView; 

_hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectNull]; 

_hostingView受到自動佈局。)如果我再添加一個圖表:

CPTXYGraph *graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; 
_hostingView.hostedGraph = graph; 

我第一次得到這個異常:

-[CPTTextStyle attributes]: unrecognized selector sent to instance 0xa392900 
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CPTTextStyle attributes]: unrecognized selector sent to instance 0xa392900' 
5 myapp      0x00074325 -[CPTAxis updateAxisLabelsAtLocations:inRange:useMajorAxisLabels:] + 1141 
6 myapp      0x00075662 -[CPTAxis relabel] + 1202 

絕望我hav Ë然後在updateAxisLabelsAtLocations:inRange:useMajorAxisLabels固定的:

NSDictionary *textAttributes = nil; 
BOOL hasAttributedFormatter = FALSE; 

,然後得到一個異常:

-[__NSCFString sizeWithTextStyle:]: unrecognized selector sent to instance 0x9591e90 
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString sizeWithTextStyle:]: unrecognized selector sent to instance 0x9591e90' 
5 myapp      0x00081520 -[CPTTextLayer sizeThatFits] + 320 
6 myapp      0x0008163c -[CPTTextLayer sizeToFit] + 108 
7 myapp      0x00080559 -[CPTTextLayer initWithText:style:] + 313 
8 myapp      0x00074b87 -[CPTAxis updateAxisLabelsAtLocations:inRange:useMajorAxisLabels:] + 3159 
9 myapp      0x00075672 -[CPTAxis relabel] + 1202 

這在sizeThatFits註釋掉這一行我已經然後 '固定':

else { 
    // textSize = [myText sizeWithTextStyle:self.textStyle]; 
    } 

接下來的例外是:

-[__NSCFString drawInRect:withTextStyle:inContext:]: unrecognized selector sent to instance 0xa162bd0 
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString drawInRect:withTextStyle:inContext:]: unrecognized selector sent to instance 0xa162bd0' 
5 myapp      0x00081dc8 -[CPTTextLayer renderAsVectorInContext:] + 1144 
6 myapp      0x00063f60 -[CPTLayer drawInContext:] + 112 

其通過renderAsVectorInContext註釋如下代碼的固定:

else { 
    // [myText drawInRect:newBounds 
    //  withTextStyle:self.textStyle 
    //   inContext:context]; 
    } 

現在最後沒有引發異常和圖形邊界被示出。但是,如果我然後開始添加數據/圖例等新的異常拋出:(

沒有文字顯示在軸等。當然,這是因爲我已經註釋掉了代碼。但任何線索爲什麼這些例外?都扔我絕望; S

好像我已經錯過了在積分一些基本的東西,但我的集成(CorePlot 1.3雖然)在iOS6的應用程序,前一段時間的工作罰款Xcode4

回答

6

檢查。核心繪圖需要-ObjC-all_load。有關更多信息,請參閱核心繪圖wiki

+0

謝謝埃裏克 - 很好的解脫!現在感到愚蠢:)任何計劃重構CorePlot使用ARC? –

+1

2.0版本(已經在分支機構中)將放棄GC支持並使用ARC。目前還沒有發佈時間表。 –

相關問題