在我的应用程序中,我使用card.io扫描信用卡。它在iOS 9中运行良好。在iOS 10中,应用程序崩溃,我无法在xcode 8 beta 2控制台中找到崩溃日志,因为它会抛出大量垃圾消息。requestAccessForMediaType在iOS 10中崩溃
然后我检查了隐私 - >设置以查看相机是否禁用了我的应用程序,但我的应用程序未在该部分中列出。请注意,iOS 10不会为我的应用程序授予使用相机的权限。
我用下面的代码来请求权限:
-(BOOL)checkCameraPermissions{
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusAuthorized)
{
// start card-io
return YES;
}
else if(authStatus == AVAuthorizationStatusNotDetermined)
{
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted)
{
if(granted)
{
//Start card-io
[self testIsNewCard];
}
}];
}
else if (authStatus == AVAuthorizationStatusRestricted)
{
//Alert
// Alert camera denied
UIAlertController *aCon=[UIAlertController alertControllerWithTitle:@"Camera denied" message:@"Camera cannot be used" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ok =[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[aCon dismissViewControllerAnimated:YES completion:nil];
}];
[aCon addAction:ok];
[self presentViewController:aCon animated:YES completion:nil];
return NO;
}
return NO;
}
当我运行该代码时,authStatus返回为AVAuthorizationStatusNotDetermined
,并在其后进入块应用正确的崩溃requestAccessForMediaType:AVMediaTypeVideo
有太多的垃圾日志显示在控制台中,我无法找到崩溃消息。
编辑:我发现了一个选项,在Xcode禁用所有不必要的日志8回答甚至禁用回溯调试完毕后公布here.但还是Xcode中没有表现出任何崩溃日志。
我xcode8只是显示这个消息,并且应用程序只是退出:
App[1124:226447] [access] <private>
我也试过试图请求媒体访问时,复位位置和隐私,但仍是应用程序崩溃。
任何想法为什么会发生这种情况?
你有没有找到这方面的解决方案? –
不,我仍然试图找出它 –
就像你我没有得到任何崩溃日志! –