2
此錯誤只發生在iPad設備。
我在使用UIAlertController時出現波紋異常。
*終止應用程序由於未捕獲的異常 'NSGenericException',原因: ':應該有一個非零sourceView或barButtonItem設置 呈現發生之前UIPopoverPresentationController ( 0x15794370> < _UIAlertControllerActionSheetRegularPresentationController)'。
我顯示ActionSheet代碼如下
// Cancel Button
UIAlertAction *actionCancel = [UIAlertAction
actionWithTitle:NSLocalizedString(@"IDS_LABEL_CANCEL", nil)
style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
// cancel
//action handler
[self actionHandler:nil withTag:0 withButtonIndex:0];
}];
// print button
UIAlertAction *actionPrint = [UIAlertAction
actionWithTitle:NSLocalizedString(@"IDS_LABEL_PRINT", nil)
style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
//action handler
[self actionHandler:nil withTag:kAttachmentActionSheetTag withButtonIndex:0];
}];
// Create action sheet
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:nil message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
[alertController addAction:actionCancel];
[alertController addAction:actionPrint];
// show aciton sheet
[self presentViewController:alertController animated:YES
completion:nil] ;
三江源mmcomb。你剛剛救了我。 – Sabareesh 2014-09-03 10:02:59
如果你沒有'barButtonItem',你不需要'sourceView'和'sourceRect'嗎?在文檔中討論'sourceRect':「將此屬性與sourceView屬性結合使用以指定彈出窗口的錨點位置」。 – 2015-04-29 15:01:32