Application crash due to UIAlertController in ios 8

I am developing a custom keyboard app and in this app I want to show the UIAlertController but it crashes with the following error.

Application terminated due to uncaught "NSGenericException", reason: "Your application presented a UIAlertController () of style UIAlertControllerStyleActionSheet. ModalPresentationStyle UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this sourcePresentationPopover. You must provide location information for this sourcePresentationPopover. You must provide location information for this sourcePresentationPopover. , and sourceRect or barButtonItem. If this information is not known when you present the alert controller, you can provide it in the UIPopoverPresentationControllerDelegate -prepareForPopoverPresentation method. '

I used the following code ...

     UIAlertController * alert=   [UIAlertController
                             alertControllerWithTitle:@"Info"
                             message:@"You are using UIAlertController"
                             preferredStyle:UIAlertControllerStyleAlert];

     UIAlertAction* ok = [UIAlertAction
                    actionWithTitle:@"OK"
                    style:UIAlertActionStyleDefault
                    handler:^(UIAlertAction * action)
                    {
                        [alert dismissViewControllerAnimated:YES completion:nil];

                    }];
     UIAlertAction* cancel = [UIAlertAction
                        actionWithTitle:@"Cancel"
                       style:UIAlertActionStyleDefault
                       handler:^(UIAlertAction * action)
                       {
                           [alert dismissViewControllerAnimated:YES completion:nil];

                       }];

    [alert addAction:ok];
    [alert addAction:cancel];

    [self presentViewController:alert animated:YES completion:nil];

      

So how can I decide?

+3
iphone ios8 uialertcontroller


source to share


No one has answered this question yet

Check out similar questions:

55
Swift UIAlertController & # 8594; ActionSheet iPad iOS8 Crashes
42
UIActionSheet from Popover with iOS8 GM
five
UIAlertController and UIPopoverController in a Universal App?
2
Can Swift Universal app run UIActionSheet and / or UIActionController from the same assembly or are they still broken?
2
Game Center Stakes or Leaderboards Crash on iPad iOS 8
1
Is it possible to change the style of the modal presentation for the UIAlertController with the preferred UIAlertControllerStyleActionSheet style?
0
iOS popover show will crash twice
0
UIPickerView in UIAlertController gives error in iPad only correctly in iPhone?
0
uncaught exception "NSGenericException: Application exposed UIAlertController style UIAlertControllerStyleActionSheet
0
Crash ActionSheet on iPad (camera button)



All Articles
Loading...
X
Show
Funny
Dev
Pics