I could reproduce the crash on the VUFORIA Sample, coding in the ImageTargetsViewController.mm
- When using the ImageTarget Sample, pause the AR: [vapp pauseAR:&error];
- Show the UIIMagePickerController (Source type camera)
- On dismiss of the picker release it and resume AR [vapp resumeAR:&error];
- It will crash on the init of the camera: QCAR::CameraDevice::getInstance().init(mCamera);
LOG reports this:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The activeVideoMinFrameDuration passed is not supported by the receiver's active format. Use -activeFormat.videoSupportedFrameRateRanges to discover valid ranges.'
*** First throw call stack:
(0x2e1bef4b 0x3854e6af 0x2d0cce0b 0x184a4f 0x1861d1 0x12e519 0x367607 0x11ef49 0x11e169 0x84d03 0x5bd61 0x80169 0x2eb9938b 0x2e18a0df 0x2e189cf7 0x2e188093 0x2e0f2c27 0x2e0f2a0b 0x32dd1283 0x30996049 0x5aa43 0x5a268)
libc++abi.dylib: terminating with uncaught exception of type NSException
Picker is shown on tap on the AR, this way:
- (void)autofocus:(UITapGestureRecognizer *)sender
{
NSError *error = nil;
[vapp pauseAR:&error];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.modalPresentationStyle = UIModalPresentationCurrentContext;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:nil];
}
On dismiss I resume this way:
- (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingMediaWithInfo: (NSDictionary *) info {
[self dismissViewControllerAnimated: YES completion:^{
//destroy picker
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[picker release];
[self performSelector:@selector(reinit) withObject:nil afterDelay:2];
}];
}
- (void) reinit {
NSError * error = nil;
[vapp resumeAR:&error];
}
Sorry, its five minutes code, so may contain errors;
- Development OS (Mac OS X, Windows, Linux): MAC OS X - Mobile OS and Version: iOS 7.0.4 - Mobile Device Manufacturer and Model name: Apple iPhone4 - Do the Vuforia Sample Applications show the same behavior?: Yes, slightly modified
Crash after having presented UIImagePickerController and resumin
Sorry, its five minutes code, so may contain errors;
In future you might like to spend more than 5 minutes to fully debug your code before posting on forums...
Here's a cleaned up version:
Crash after having presented UIImagePickerController and resumin
Hi,
Attached the screenshot of what I get using your modifications, after dismissing the UIImagePickerController.
Crash after having presented UIImagePickerController and resumin
you write that it is simply necessary to stop the camera. Is that correct?
Yes this should be possible. In the previous samples pause/resume was the best way to suspend activity rather than going the whole route with init/deinit
Crash after having presented UIImagePickerController and resumin
It seems I forgot to add a couple of lines for QCAR::onPause
Crash after having presented UIImagePickerController and resumin
Crash after having presented UIImagePickerController and resumin
Hi,
using your code as is does not work, because you probably erroneously inverted the deinit call with the stop call; you need to call stop before deinit.
Crash after having presented UIImagePickerController and resumin
Today I could test with other devices; seems to work only on iPhone5s, while on Iphone5, Iphone4 & Iphone4s it persist crashing (even with latests iOS 7.0.6)
Can you test with another device than iphone 5s?
Best Regards
Crash after having presented UIImagePickerController and resumin
I will try to look at this today, and yes this seems specific to non iPhone5S devices on iOS7 - iOS6 seems ok.
I will revert back when I have more info.
N
Crash after having presented UIImagePickerController and resumin
Hi Josef,
After talking to the development team and doing a few experiments I have come up with a few modifications that should enable this code to work across all devices.
Crash after having presented UIImagePickerController and resumin
Hi,
the good news is that its not crashing anymore. Do you think this might get fixed somehow in the future or the hard deinitialization workaround will be the only way to get this working? Did you understand what is happening at low level at the camera state?
Crash after having presented UIImagePickerController and resumin
Great to hear this is working for you :)
I have notified the development team and hopefully they will fix this in a future release.
cheers,
N
Crash after having presented UIImagePickerController and resumin
I'm not doing quite the same thing (I'm using a bunch of AV* stuff to present a custom photo user interface), but the end result is still the same with the same crash reported.
Crash after having presented UIImagePickerController and resumin
Thanks very much for this Tom.
I have passed this on to the development team - much appreciated.
cheers
N
Crash after having presented UIImagePickerController and resumin
I am having the exact same issue in Cloud Recognition. I am upgrading to SDK 2-8-7 and nearly completed except for this error. I am getting the exact same error at the exact same location as the other when doing a resumeAR.
Crash after having presented UIImagePickerController and resumin
Have you tried the two workarounds posted below?
N
Crash after having presented UIImagePickerController and resumin
Working on them right now.
The crash stopped in the resumeAR. But the EaglView scanning is not fully engaging... I think I'm just missing something obvious.
I'm reviewing my code.. I'll keep you up to date...
Crash after having presented UIImagePickerController and resumin
Ok... I now have everything working. I had to use a combination of both Tom Wilson solution and the first solution and your solution that had this code for the pauseAR:
Crash after having presented UIImagePickerController and resumin
Great - many thanks for the update :)
N
Crash after having presented UIImagePickerController and resumin
Hi tomwilson,
this seems promising, especially a good hint for Vuforia guys to fix this.
Thank you very much for your contribution.
Crash after having presented UIImagePickerController and resumin
Hi, we are experiencing the same issue. Is the development team working on a fix for this because none of the workarounds posted below work for us?
Crash after having presented UIImagePickerController and resumin
because none of the workarounds posted below work for us?
Why not?
Please check the code and try again.
N