将OS X更新为El Capitan和Core Plot崩溃:(

时间:2015-10-01 21:22:11

标签: macos crash core-plot osx-elcapitan

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

  

2015-10-02 00:18:48.097 checkMyMac [2410:186855] *** - [ NSArrayM   insertObject:atIndex:]:object不能为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显示] + 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   运行] + 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
    }
}

1 个答案:

答案 0 :(得分:0)

这是已在release-2.0分支上修复的已知问题。有关详细信息,请参阅核心图issue #210