Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXC_BAD_ACCESS (code=1) #28

Closed
lewishalliday opened this issue Nov 21, 2014 · 9 comments
Closed

EXC_BAD_ACCESS (code=1) #28

lewishalliday opened this issue Nov 21, 2014 · 9 comments

Comments

@lewishalliday
Copy link

I'm having an issue with this.

I'm a big fan of SCLAlertView but i'm having an issue with a section within my code.

I am using the code elsewhere in my project but when using it within another view controller I'm receiving the above error.

It is showing itself within UIImage+ImageEffects.m on line [keyWindow.layer renderInContext:context]; within

  • (UIImage *)convertViewToImage

This is the code I am using to call the alert

SCLAlertView *alert = [[SCLAlertView alloc] init];
UITextField *textField = [alert addTextField:@"Quantity"];
[textField setKeyboardType:UIKeyboardTypeNumberPad];
alert.backgroundType = Blur;
alert.shouldDismissOnTapOutside = YES;
[alert showSuccess:self title:@"Quantity" subTitle:@"Enter Quantity" closeButtonTitle:@"Done" duration:0.0f];

Thanks in advance

Edit: If i leave the alert view standard it works perfectly. It only seems to have an issue when customising the alert where it crashes

SCLAlertView *alert = [[SCLAlertView alloc] init];
UITextField *textField = [alert addTextField:@"Quantity"];
[textField setKeyboardType:UIKeyboardTypeNumberPad];
alert.backgroundType = Blur;
[alert showSuccess:self title:@"Quantity" subTitle:@"Enter Quantity" closeButtonTitle:@"Done" duration:0.0f];

That works fine

@dogo
Copy link
Owner

dogo commented Nov 21, 2014

Hi @lewishalliday , I need more info 👍

iOS version
Simulator ? or Device?

Your code its running fine on iPhone 6 Simulator

ios simulator screen shot 21 11 2014 13 56 22

@lewishalliday
Copy link
Author

It's doing it in both physical and virtual device.

@dogo
Copy link
Owner

dogo commented Nov 21, 2014

okay and your iOS version ? which device ?
I'm not able to reproduce

@lewishalliday
Copy link
Author

iOS 8.1 - iPhone 6 Plus (Physical)
iOS 8.1 - iPhone 6 (Virtual)

@lewishalliday
Copy link
Author

I had a look and somebody mentioned about it running on a different thread, but even when running it on the main thread its doing the same thing.

@dogo
Copy link
Owner

dogo commented Nov 25, 2014

@lewishalliday I'm not able to reproduce.
Probably is something related to your code.

@lewishalliday
Copy link
Author

Don't worry about it. I think there is something else that is causing an issue as the exact same code is fine in another class. I'll just re-create the class and go from there.

Thanks for your help tho!

@mbcoder17
Copy link

I am having this same issue displaying it in a UITableViewController subclass.

@mbcoder17
Copy link

It crashes on this line: [keyWindow.layer renderInContext:context];

And this seems to be due to the fact that renderInContext cannot be called on a background thread: http://stackoverflow.com/questions/15135208/objective-c-renderincontext-crash-on-background-thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants