应用程序偶尔会崩溃,调试有困难

时间:2014-09-22 06:00:19

标签: ios

我收到代码= 1的EXC_BAD_ACCESS崩溃,我很难解释回溯。当它崩溃时,它到达汇编之前的最后一行显示所有具有适当内存的内容,并且没有任何内容。

从回溯中看来,导致崩溃的事情似乎很多。我真的很感激任何帮助。

修改 这是新的回溯:

* thread #4: tid = 0x7126c, 0x00000001922bd2c0 libsystem_platform.dylib`OSAtomicCompareAndSwap32Barrier + 24, queue = 'com.example.tangible'
    frame #0: 0x00000001922bd2c0 libsystem_platform.dylib`OSAtomicCompareAndSwap32Barrier + 24
    frame #1: 0x00000001922c1ef0 libsystem_pthread.dylib`pthread_rwlock_unlock + 168
    frame #2: 0x0000000191b5a8bc libobjc.A.dylib`class_copyProtocolList + 248
    frame #3: 0x000000018529fdf0 CoreFoundation`__methodDescriptionForSelector + 60
    frame #4: 0x00000001851c71f0 CoreFoundation`-[NSObject(NSObject) methodSignatureForSelector:] + 44
    frame #5: 0x0000000188111084 SpriteKit`-[SKThreadSafeMapTable methodSignatureForSelector:] + 116
    frame #6: 0x000000018529d81c CoreFoundation`___forwarding___ + 204
    frame #7: 0x00000001851bd78c CoreFoundation`_CF_forwarding_prep_0 + 92
    frame #8: 0x000000018811c330 SpriteKit`+[SKTexture lookupTextureCacheForName:] + 36
    frame #9: 0x000000018811dbec SpriteKit`-[SKTexture initTextureCacheWithImageData] + 56
    frame #10: 0x000000018811ecb0 SpriteKit`-[SKTexture initWithImageNamed:] + 232
    frame #11: 0x000000018811f6e8 SpriteKit`+[SKTexture textureWithImageNamed:] + 68
    frame #12: 0x000000018813e05c SpriteKit`-[SKSpriteNode initWithImageNamed:] + 44
  * frame #13: 0x00000001000c7d04 Tangible`-[ControlScene addBlockToScreen:](self=0x0000000125617be0, _cmd=0x000000010052a4da, block=0x00000001786f7580) + 436 at ControlScene.mm:243
    frame #14: 0x00000001000c5aa8 Tangible`-[ControlScene updateDisplay](self=0x0000000125617be0, _cmd=0x0000000189cd2290) + 876 at ControlScene.mm:114
    frame #15: 0x00000001000c9950 Tangible`-[ControlScene updateBlocks:](self=0x0000000125617be0, _cmd=0x0000000100529bc8, b=0x0000000178851e50) + 348 at ControlScene.mm:357
    frame #16: 0x00000001000bbdb4 Tangible`-[StageViewController frameReady:](self=0x0000000125509670, _cmd=0x0000000100529bd6, frame=<unavailable>) + 640 at StageViewController.mm:94
    frame #17: 0x00000001000bfb5c Tangible`-[VideoSource captureOutput:didOutputSampleBuffer:fromConnection:](self=0x000000017026ccc0, _cmd=0x0000000183fe21c9, captureOutput=0x000000017022dea0, sampleBuffer=0x0000000129116b10, connection=0x000000017041d410) + 340 at VideoSource.mm:131
    frame #18: 0x0000000183f683c4 AVFoundation`__74-[AVCaptureVideoDataOutput _AVCaptureVideoDataOutput_VideoDataBecameReady]_block_invoke + 412
    frame #19: 0x000000019212c014 libdispatch.dylib`_dispatch_call_block_and_release + 24
    frame #20: 0x000000019212bfd4 libdispatch.dylib`_dispatch_client_callout + 16
    frame #21: 0x00000001921324a8 libdispatch.dylib`_dispatch_queue_drain + 640
    frame #22: 0x000000019212e4c0 libdispatch.dylib`_dispatch_queue_invoke + 68
    frame #23: 0x00000001921330f4 libdispatch.dylib`_dispatch_root_queue_drain + 104
    frame #24: 0x00000001921334fc libdispatch.dylib`_dispatch_worker_thread2 + 76
    frame #25: 0x00000001922c16bc libsystem_pthread.dylib`_pthread_wqthread + 356

以下是第234行的代码:

-(void)addBlockToScreen:(Block *) block {
    //NSLog(@"start");
    Block *copy = [[Block alloc] initWithCode:block.code x:block.x y:block.y];
    //NSLog(@"block copied");
    NSString *copyStr = [NSString stringWithString:copy.imageName];
    //NSLog(@"str created");
    if ([copyStr length]>0) {
        //NSLog(@"1: %@", copyStr);
        SKSpriteNode * shape = [[SKSpriteNode alloc] initWithImageNamed:copyStr];
        shape.anchorPoint = CGPointMake(.5, .5);
        shape.position = [self returnPointForX:copy.x+copy.trueX*1.68 Y:copy.y+copy.trueY*1.68];
        [self addChild:shape];
        shape.name = @"block";
    }
    //NSLog(@"done");
}

我试图解决这个崩溃问题。 copyStr一定不能为零吗?它崩溃在“SKSpriteNode * shape = [[SKSpriteNode alloc] initWithImageNamed:copyStr];”线。

第二次修改 代码在不同的时间崩溃,这次是在opencv框架中。我根本没有改变代码。也许这是相关的?..

* thread #4: tid = 0x72a0f, 0x0000000192229bd4 libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap + 8, queue = 'com.example.tangible'
    frame #0: 0x0000000192229bd4 libsystem_kernel.dylib`_kernelrpc_mach_vm_deallocate_trap + 8
    frame #1: 0x0000000192229e1c libsystem_kernel.dylib`mach_vm_deallocate + 32
    frame #2: 0x0000000192272958 libsystem_malloc.dylib`deallocate_pages + 68
    frame #3: 0x00000001922728cc libsystem_malloc.dylib`free_large + 368
    frame #4: 0x0000000100080404 Tangible`cv::Mat::release(this=0x0000000100dfbb40) + 128 at mat.hpp:367
    frame #5: 0x000000010008032c Tangible`~Mat(this=0x0000000100dfbb40) + 32 at mat.hpp:276
    frame #6: 0x0000000100080138 Tangible`~Mat(this=0x0000000100dfbb40) + 28 at mat.hpp:275
    frame #7: 0x0000000100087f70 Tangible`-[StageViewController frameReady:](self=0x000000014fe0f330, _cmd=0x00000001004f5bd6, frame=<unavailable>) + 1108 at StageViewController.mm:140
  * frame #8: 0x000000010008bb44 Tangible`-[VideoSource captureOutput:didOutputSampleBuffer:fromConnection:](self=0x000000017826c1c0, _cmd=0x0000000183fe21c9, captureOutput=0x000000017003bb20, sampleBuffer=0x0000000153906560, connection=0x0000000170619fc0) + 340 at VideoSource.mm:131
    frame #9: 0x0000000183f683c4 AVFoundation`__74-[AVCaptureVideoDataOutput _AVCaptureVideoDataOutput_VideoDataBecameReady]_block_invoke + 412
    frame #10: 0x000000019212c014 libdispatch.dylib`_dispatch_call_block_and_release + 24
    frame #11: 0x000000019212bfd4 libdispatch.dylib`_dispatch_client_callout + 16
    frame #12: 0x00000001921324a8 libdispatch.dylib`_dispatch_queue_drain + 640
    frame #13: 0x000000019212e4c0 libdispatch.dylib`_dispatch_queue_invoke + 68
    frame #14: 0x00000001921330f4 libdispatch.dylib`_dispatch_root_queue_drain + 104
    frame #15: 0x00000001921334fc libdispatch.dylib`_dispatch_worker_thread2 + 76
    frame #16: 0x00000001922c16bc libsystem_pthread.dylib`_pthread_wqthread + 356

inline void Mat::release()
{
    if( refcount && CV_XADD(refcount, -1) == 1 )
        deallocate();
    data = datastart = dataend = datalimit = 0;
    size.p[0] = 0;
    refcount = 0;
}

0 个答案:

没有答案