将 OS X 更新为 El Capitan 和 Core Plot 崩溃:(
Update OS X to El Capitan and Core Plot crashes :(
为 10.11 更新了我的 OS
尝试 运行 我在 Yosemite 上运行良好的项目
但是核心情节有些奇怪
这是崩溃日志,有什么想法吗?
2015-10-02 00:18:48.097 checkMyMac[2410:186855] *** -[NSArrayM
insertObject:atIndex:]: object cannot be nil 2015-10-02 00:18:48.098
checkMyMac[2410:186855] ( 0 CoreFoundation
0x00007fff95f55bd2 __exceptionPreprocess + 178 1 libobjc.A.dylib
0x00007fff9bc284fa objc_exception_throw + 48 2 CoreFoundation
0x00007fff95e6c370 checkForCloseTag + 0 3 CorePlot
0x0000000100108a79 CPTPushCGContext + 169 4 CorePlot
0x0000000100108938
-[NSAttributedString(CPTPlatformSpecificAttributedStringExtensions) drawInRect:inContext:] + 40 5 CorePlot
0x00000001000f6016 -[CPTTextLayer renderAsVectorInContext:] + 694 6
CorePlot 0x00000001000f70f5 -[CPTLayer
drawInContext:] + 85 7 QuartzCore
0x00007fff9681fcdd _ZN2CA5Layer8display_Ev + 649 8 CorePlot
0x00000001000f708b -[CPTLayer display] + 91 9 QuartzCore
0x00007fff96811e51 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE
+ 603 10 QuartzCore 0x00007fff96811979 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 35 11 QuartzCore 0x00007fff96810e4d
_ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277 12 QuartzCore 0x00007fff96810a98
_ZN2CA11Transaction6commitEv + 508 13 QuartzCore 0x00007fff9681c28f
_ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 71 14 CoreFoundation 0x00007fff95eeae07
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 15 CoreFoundation 0x00007fff95eead77
__CFRunLoopDoObservers + 391 16 CoreFoundation 0x00007fff95ec9d58 CFRunLoopRunSpecific + 328 17 HIToolbox
0x00007fff8a4e0d55 RunCurrentEventLoopInMode + 235 18 HIToolbox
0x00007fff8a4e0a97 ReceiveNextEventCommon + 184 19 HIToolbox
0x00007fff8a4e09cf _BlockUntilNextEventMatchingListInModeWithFilter +
71 20 AppKit 0x00007fff8aed2f3a
_DPSNextEvent + 1067 21 AppKit 0x00007fff8aed2369 -[NSApplication
_nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454 22 AppKit 0x00007fff8aec6ecc -[NSApplication
run] + 682 23 AppKit 0x00007fff8ae90162
NSApplicationMain + 1176 24 libdyld.dylib
0x00007fff8c85f5ad start + 1 25 ???
0x0000000000000003 0x0 + 3
已从 git 中心下载核心情节的新副本
编译为框架和相同的故事:-(
好的所以我修改了源代码
如果有人遇到同样的问题,这是我的(不是很好的解决方案
在名为 CPTTextLayer.m
的文件中
-(void)renderAsVectorInContext:(CGContextRef)context
{
if ( self.hidden ) {
return;
}
//////////////////////////////////////////////////
//Added by me to avoid crash when self.text
// or self.attributedText is nil
//////////////////////////////////////////////////
if (!self.text || !self.attributedText)
{
return;
}
///////////////////////////////////////////////////
NSString *myText = self.text;
if ( myText.length > 0 ) {
[super renderAsVectorInContext:context];
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
CGContextSaveGState(context);
CGContextTranslateCTM(context, CPTFloat(0.0), self.bounds.size.height);
CGContextScaleCTM( context, CPTFloat(1.0), CPTFloat(-1.0) );
#endif
CGRect newBounds = CGRectInset(self.bounds, kCPTTextLayerMarginWidth, kCPTTextLayerMarginWidth);
newBounds.origin.x += self.paddingLeft;
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
newBounds.origin.y += self.paddingTop;
#else
newBounds.origin.y += self.paddingBottom;
#endif
newBounds.size.width -= self.paddingLeft + self.paddingRight;
newBounds.size.height -= self.paddingTop + self.paddingBottom;
NSAttributedString *styledText = self.attributedText;
if ( (styledText.length > 0) && [styledText respondsToSelector:@selector(drawInRect:)] ) {
[styledText drawInRect:newBounds
inContext:context];
}
else {
[myText drawInRect:newBounds
withTextStyle:self.textStyle
inContext:context];
}
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
CGContextRestoreGState(context);
#endif
}
}
这是一个已知问题,已在 release-2.0 分支上修复。有关详细信息,请参阅核心情节 issue #210。
为 10.11 更新了我的 OS 尝试 运行 我在 Yosemite 上运行良好的项目 但是核心情节有些奇怪 这是崩溃日志,有什么想法吗?
2015-10-02 00:18:48.097 checkMyMac[2410:186855] *** -[NSArrayM insertObject:atIndex:]: object cannot be nil 2015-10-02 00:18:48.098 checkMyMac[2410:186855] ( 0 CoreFoundation
0x00007fff95f55bd2 __exceptionPreprocess + 178 1 libobjc.A.dylib
0x00007fff9bc284fa objc_exception_throw + 48 2 CoreFoundation
0x00007fff95e6c370 checkForCloseTag + 0 3 CorePlot
0x0000000100108a79 CPTPushCGContext + 169 4 CorePlot
0x0000000100108938 -[NSAttributedString(CPTPlatformSpecificAttributedStringExtensions) drawInRect:inContext:] + 40 5 CorePlot
0x00000001000f6016 -[CPTTextLayer renderAsVectorInContext:] + 694 6
CorePlot 0x00000001000f70f5 -[CPTLayer drawInContext:] + 85 7 QuartzCore
0x00007fff9681fcdd _ZN2CA5Layer8display_Ev + 649 8 CorePlot
0x00000001000f708b -[CPTLayer display] + 91 9 QuartzCore
0x00007fff96811e51 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 603 10 QuartzCore 0x00007fff96811979 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 35 11 QuartzCore 0x00007fff96810e4d _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277 12 QuartzCore 0x00007fff96810a98 _ZN2CA11Transaction6commitEv + 508 13 QuartzCore 0x00007fff9681c28f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 71 14 CoreFoundation 0x00007fff95eeae07 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 15 CoreFoundation 0x00007fff95eead77 __CFRunLoopDoObservers + 391 16 CoreFoundation 0x00007fff95ec9d58 CFRunLoopRunSpecific + 328 17 HIToolbox
0x00007fff8a4e0d55 RunCurrentEventLoopInMode + 235 18 HIToolbox
0x00007fff8a4e0a97 ReceiveNextEventCommon + 184 19 HIToolbox
0x00007fff8a4e09cf _BlockUntilNextEventMatchingListInModeWithFilter + 71 20 AppKit 0x00007fff8aed2f3a _DPSNextEvent + 1067 21 AppKit 0x00007fff8aed2369 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454 22 AppKit 0x00007fff8aec6ecc -[NSApplication run] + 682 23 AppKit 0x00007fff8ae90162 NSApplicationMain + 1176 24 libdyld.dylib
0x00007fff8c85f5ad start + 1 25 ???
0x0000000000000003 0x0 + 3
已从 git 中心下载核心情节的新副本 编译为框架和相同的故事:-(
好的所以我修改了源代码 如果有人遇到同样的问题,这是我的(不是很好的解决方案
在名为 CPTTextLayer.m
的文件中-(void)renderAsVectorInContext:(CGContextRef)context
{
if ( self.hidden ) {
return;
}
//////////////////////////////////////////////////
//Added by me to avoid crash when self.text
// or self.attributedText is nil
//////////////////////////////////////////////////
if (!self.text || !self.attributedText)
{
return;
}
///////////////////////////////////////////////////
NSString *myText = self.text;
if ( myText.length > 0 ) {
[super renderAsVectorInContext:context];
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
CGContextSaveGState(context);
CGContextTranslateCTM(context, CPTFloat(0.0), self.bounds.size.height);
CGContextScaleCTM( context, CPTFloat(1.0), CPTFloat(-1.0) );
#endif
CGRect newBounds = CGRectInset(self.bounds, kCPTTextLayerMarginWidth, kCPTTextLayerMarginWidth);
newBounds.origin.x += self.paddingLeft;
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
newBounds.origin.y += self.paddingTop;
#else
newBounds.origin.y += self.paddingBottom;
#endif
newBounds.size.width -= self.paddingLeft + self.paddingRight;
newBounds.size.height -= self.paddingTop + self.paddingBottom;
NSAttributedString *styledText = self.attributedText;
if ( (styledText.length > 0) && [styledText respondsToSelector:@selector(drawInRect:)] ) {
[styledText drawInRect:newBounds
inContext:context];
}
else {
[myText drawInRect:newBounds
withTextStyle:self.textStyle
inContext:context];
}
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
CGContextRestoreGState(context);
#endif
}
}
这是一个已知问题,已在 release-2.0 分支上修复。有关详细信息,请参阅核心情节 issue #210。