rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 582 forks source link

Crash only when Testflight (compiled and run OK via Xcode) #78

Closed louistran99 closed 9 years ago

louistran99 commented 10 years ago

App runs great when I build it in Xcode but crashed when I distribute to beta testers via TestFlight. The crash report is as follow:

Thread 2 name: Dispatch queue: me.corsin.SCRecorder.RecordSession Thread 2 Crashed: 0 libsystem_kernel.dylib 0x36069dfc pthread_kill + 8 1 libsystem_pthread.dylib 0x360e7d32 pthread_kill + 58 2 libsystem_c.dylib 0x36009904 abort + 72 3 libc++abi.dylib 0x353449c4 abort_message + 84 4 libc++abi.dylib 0x3535e66c default_terminate_handler() + 264 5 libobjc.A.dylib 0x35a23f22 _objc_terminate() + 190 6 libc++abi.dylib 0x3535bde0 std::terminate(void (*)()) + 76 7 libc++abi.dylib 0x3535b5a4 cxa_throw + 108 8 libobjc.A.dylib 0x35a23d5a objc_exception_throw + 246 9 CoreFoundation 0x2818d834 -[NSArrayM objectAtIndex:] + 228 10 Postlets 0x000d294c 0xa4000 + 190796 11 Postlets 0x000d2b4e 0xa4000 + 191310 12 Postlets 0x00320c7a 0xa4000 + 2608250 13 Postlets 0x00324950 0xa4000 + 2623824 14 Postlets 0x00325474 0xa4000 + 2626676 15 libdispatch.dylib 0x35f837b8 _dispatch_call_block_and_release + 8 16 libdispatch.dylib 0x35f8b5ac _dispatch_queue_drain + 948 17 libdispatch.dylib 0x35f85f80 _dispatch_queue_invoke + 80 18 libdispatch.dylib 0x35f8cb98 _dispatch_root_queue_drain + 336 19 libdispatch.dylib 0x35f8dcd2 _dispatch_worker_thread3 + 90 20 libsystem_pthread.dylib 0x360e4e2e _pthread_wqthread + 666 21 libsystem_pthread.dylib 0x360e4b80 start_wqthread + 4

Here's how I set up the SCRecorder and SCRecordSession:

-(void) setupSCRecorder {
    _recorder = [SCRecorder recorder];
    _recorder.sessionPreset = AVCaptureSessionPreset1280x720;
    _recorder.audioEnabled = NO;
   _recorder.delegate = self;
    _recorder.autoSetVideoOrientation = NO;
    _recorder.photoEnabled = YES;               // enable capturing still photo
    _recorder.previewView = _preview;
//    NSLog(@"setupSCRecorder -- width:%1.1f\t height :%1.1f",_preview.frame.size.width,_preview.frame.size.height);

[_recorder openSession:^(NSError *sessionError, NSError *audioError, NSError *videoError, NSError *photoError) {
    NSLog(@"==== Opened session ====");
    NSLog(@"Session error: %@", sessionError.description);
    NSLog(@"Audio error : %@", audioError.description);
    NSLog(@"Video error: %@", videoError.description);
    NSLog(@"Photo error: %@", photoError.description);
    NSLog(@"Preview Layer: %@",[_recorder.previewLayer description]);
    NSLog(@"=======================");
    [_recorder startRunningSession];
    [self setupRecordingSession];
    [self setUpStillCapture];
}];
}

-(void) setupRecordingSession {
    if (_recorder.photoOutput) {
        [_recorder.photoOutput addObserver:self forKeyPath:@"capturingStillImage"    options:NSKeyValueObservingOptionNew context:nil];
    }

if (!_recorder.recordSession) {
    SCRecordSession *session = [SCRecordSession recordSession];
    session.suggestedMaxRecordDuration = CMTimeMakeWithSeconds(kVCMaximumRecordingTimeInSeconds, kVCRecordingTimeScale);
    session.shouldTrackRecordSegments = YES;
    _recorder.recordSession = session;

    [_videoManager ensureVideo];

}
}

Any pointer as to why SCRecorder crashes under Testflight built is appreciated...

rFlex commented 10 years ago

Can you symbolicate your crash report so I can see which methods made your app crashes?

louistran99 commented 10 years ago

the .dSYM file is included with the TestFlight build which is meant to symbolicate the crash report. However, as you can see it doesn't for some reason. I did hook up the TestFlight build to Xcode and get the NSLog out to the console -- "Devices" -> "Louis Tran's iPhone" on the left panel -> "the triangle at the bottom left". Here's the output on the console:

Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : ==== Opened session ==== Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : Session error: (null) Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : Audio error : (null) Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : Video error: (null) Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : Photo error: (null) Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : Preview Layer: <AVCaptureVideoPreviewLayer: 0x14f731c0> Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : ======================= Nov 6 17:01:57 Louis-Trans-iPhone kernel[0] : AppleH4CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 0, index: 0 Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : 875704422 Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : 875704438 Nov 6 17:01:57 Louis-Trans-iPhone Postlets[1092] : 1111970369 Nov 6 17:01:58 Louis-Trans-iPhone locationd[63] : Gesture EnabledForTopCLient: 1, EnabledInDaemonSettings: 1 Nov 6 17:02:01 Louis-Trans-iPhone Postlets[1092] : didRotate -- width: 320.0 height: 588.0 Nov 6 17:02:02 Louis-Trans-iPhone Postlets[1092] : didRotate -- width: 320.0 height: 588.0 Nov 6 17:02:07 Louis-Trans-iPhone Postlets[1092] : startRecordingWithSCRecorder: file:///private/var/mobile/Containers/Data/Application/43C8D039-7754-4112-92F9-227D6DD19998/tmp/1415322117SCVideo.mp4 Nov 6 17:02:07 Louis-Trans-iPhone kernel[0] : VXE380: openGated (0xb2221a00 current 0xd15fe000 ID 42 dev f5 (force f0)) cl registered = 1 (clock 1 H5speed 1 H5f 65535) Nov 6 17:02:07 Louis-Trans-iPhone kernel[0] : VXE380: closeGated (0xb2221a00) cl left: 0 Nov 6 17:02:07 Louis-Trans-iPhone Postlets[1092] : Stack = 1 Nov 6 17:02:07 Louis-Trans-iPhone Postlets[1092] : Framework = Postlets Nov 6 17:02:07 Louis-Trans-iPhone Postlets[1092] : Memory address = 0x0011cb53 Nov 6 17:02:07 Louis-Trans-iPhone Postlets[1092] : Class caller = Postlets Nov 6 17:02:07 Louis-Trans-iPhone Postlets[1092] : Function caller = 191315 Nov 6 17:02:07 Louis-Trans-iPhone Postlets[1092] : * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .. 4]' *\ First throw call stack: (0x28278c1f 0x35a23c8b 0x2818d839 0x11c951 0x11cb53 0x36ac7f 0x36e955 0x36f479 0x35f837bb 0x35f8b5b1 0x35f85f85 0x35f8cb9b 0x35f8dcd7 0x360e4e31 0x360e4b84)

rFlex commented 10 years ago

There is a bunch of calls in the SCRecordSession that use "objectAtIndex:". It may be possible that you modified the SCRecordSession's recordSegments outside of the SCRecorder dispatchQueue. The API is not very clear that you can only modify these values when the SCRecordSession is not inside an SCRecorder. I changed a bunch of stuff on the last version I pushed today (2.1.4), and the SCRecordSession is now freely modifiable even when it is set inside an SCRecorder.

Can you check if the issue has been fixed with the work I have done? If it's not, we will try something else.

louistran99 commented 10 years ago

Thanks. I'll check it out.

rFlex commented 9 years ago

Are you still having this problem?

louistran99 commented 9 years ago

?I no longer have this problem.


From: Simon CORSIN notifications@github.com Sent: Wednesday, November 26, 2014 9:15 AM To: rFlex/SCRecorder Cc: Louis Tran Subject: Re: [SCRecorder] Crash only when Testflight (compiled and run OK via Xcode) (#78)

Are you still having this problem?

Reply to this email directly or view it on GitHubhttps://github.com/rFlex/SCRecorder/issues/78#issuecomment-64679462.