macos - 更新OS X到El Capitan和Core Plot崩溃:(

标签 macos crash core-plot osx-elcapitan

我的操作系统更新为10.11
试图运行我的在优胜美地上运行良好的项目
但是核心情节有些奇怪
这是崩溃日志,有什么想法吗?

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 hub下载了核心图的新副本
编译为框架和相同的故事:-(

好吧,所以我修改了源代码
如果有人会有同样的问题,这是我的(不是很好的解决方案

在名为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

关于macos - 更新OS X到El Capitan和Core Plot崩溃:(,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32897088/

相关文章:

objective-c - Cocoa Mac Sheet 圆角(像 Xcode 4)

android - 在 Android 中使用相机拍照时出现致命信号 11 和奇怪的错误消息

Perl:创建哈希时程序崩溃

iphone - Core-Plot(饼图)中的图例问题

objective-c - 让我的子类拦截消息

c++ - Mac上的SystemC在Makefile中出错

java - 十进制输入崩溃

带有间隙的 iOS Scatter 核心图

objective-c - Cocoa Touch CorePlot 散点图未显示

c - Obj-C 有@available。 swift 有#available。我可以在 C/C++ 中使用什么?