在我的應用程序中,我使用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>
我也試過試圖請求媒體訪問時,復位位置和隱私,但仍是應用程序崩潰。
任何想法爲什麼會發生這種情況?
你有沒有找到這方面的解決方案? –
不,我仍然試圖找出它 –
就像你我沒有得到任何崩潰日誌! –