Question

I'm trying to show UIActionSheet in self.view.parentview. But I got below warning while running

<Error>: CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSetStrokeColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Code is below

self.dobActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil,nil];
[self.dobActionSheet addSubview:self.doneForActionSheet];
[self.dobActionSheet addSubview:self.cancelForActionSheet];
[self.dobActionSheet addSubview:self.dobDatepicker];
[self.dobActionSheet showInView:self.parentViewController.view];

I've put breakpoint. but get this warning in this line [self.dobActionSheet showInView:self.parentViewController.view];..

I've try to present in Viewcontroller which is embedded in tabbarController at first index. That's why, try to present with parentViewController.view instead self.view

Note: I've seen as same question here. But couldn't find answer for this.

Was it helpful?

Solution

actionSheet = [[UIActionSheet alloc] initWithTitle:@"Title"
                                              delegate:self
                                     cancelButtonTitle:nil
                                destructiveButtonTitle:nil
                                     otherButtonTitles:@"Ok"];

instead of nil value, use @""

actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:nil
cancelButtonTitle:@""
destructiveButtonTitle:nil
otherButtonTitles:nil];

OTHER TIPS

I've solved this issue from @Sunny shah answers. I've tried with his answer but have title on action sheet. Instead I tried with below code.(Title name as single space).

self.dobActionSheet = [[UIActionSheet alloc] initWithTitle:@" " delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil,nil];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top