2
由於升級到的XCode 5/7的iOS,我打電話這是應該呈現的RedLaser SDK barcodepickercontroller函數時得到以下錯誤'NSInvalidArgumentException',原因:'應用程序試圖在目標上呈現一個無模式視圖控制器。' *第一擲調用堆棧:的RedLaser SDK和零模態視圖控制器
(
0 CoreFoundation 0x02ef25e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x028dd8b6 objc_exception_throw + 44
2 UIKit 0x006e817a -[UIViewControllerpresentViewController:withTransition:completion:] + 4879
3 UIKit 0x006e8caf -[UIViewController presentViewController:animated:completion:] + 130
4 UIKit 0x006e8cef -[UIViewController presentModalViewController:animated:] + 56
5 Extinguishers 0x0000b703 -[LoginViewController scanPressed] + 1299
這是我的方法,這導致它:
-(IBAction) scanPressed
{
if (overlayController.parentPicker == nil)
{
BarcodePickerController * picker = [[BarcodePickerController alloc] init];
[picker setOverlay:overlayController];
[picker setDelegate:self];
// Initialize with portrait mode as default
picker.orientation = UIImageOrientationUp;
// The active scanning region size is set in OverlayController.m
}
// Update barcode on/off settings
[overlayController.parentPicker setScanUPCE:YES];
[overlayController.parentPicker setScanEAN8:YES];
[overlayController.parentPicker setScanEAN13:YES];
//[overlayController.parentPicker setScanSTICKY:YES];
//[overlayController.parentPicker setScanQRCODE:YES];
[overlayController.parentPicker setScanCODE128:YES];
[overlayController.parentPicker setScanCODE39:YES];
[overlayController.parentPicker setScanITF:YES];
// Data matrix decoding does not work very well so it is disabled for now
[overlayController.parentPicker setScanDATAMATRIX:NO];
// hide the status bar
[[UIApplication sharedApplication] setStatusBarHidden:YES];
// Show the scanner overlay - THIS LINE CAUSES THE CRASH
[self presentModalViewController:overlayController.parentPicker animated:TRUE];
}
我也試着升級到最新版本的Redlaser SDK,並且錯誤仍然是相同的。在切換到iOS 7之前,我沒有這個問題,因爲b ase SDK。
首先,'presentModalViewController:animated:'在iOS 6中已被棄用。嘗試使用'presentViewController:animated:completion:'代替。 –
更改爲,但同樣的錯誤。 – codeman
嘗試將您的選取器作爲子視圖添加到當前視圖中,並執行一個bringviewfront,而不是將其呈現爲模型。只是一個工作 – Bluewings