In iOS 8 , following codes crash that add image to UIActionSheet's _button valueForKey.
UIActionSheet *action = [[UIActionSheet alloc ] initWithTitle:#"Choose Action!" delegate:self cancelButtonTitle:#"Cancel" destructiveButtonTitle:nil otherButtonTitles:#"Start Auto Scroll", nil];
[[[action valueForKey:#"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:#"autoScroll.png"] forState:UIControlStateNormal];
[action showInView:self.view];
Crash Log is
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIActionSheet 0x7ff6d8c61030> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _buttons.'
How can i solve it?
What you are doing was never legal. You cannot modify an action sheet's interface directly. If your code was ever getting past the App Store Guardians, that was just an oversight.
Use a custom presentation transition animation to make a view controller view that looks like an action sheet (or, indeed, one that doesn't look like an action sheet). Making a presented view controller view that partially covers the screen is easy and legal in iOS 7 and 8.
Related
I want an alert in my project but there is an problem that when i run this code in iOS 6 device it crashes. This is my code for alert given below:
alert = [[UIAlertView alloc] initWithTitle:#""
message:#"Are You Sure Want To Exit"
delegate:nil
cancelButtonTitle:#"No"
otherButtonTitles: #"Yes", nil];
[alert performSelectorOnMainThread:#selector(show) withObject:nil waitUntilDone:YES ];
And it crashes with following exception:
*** Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'Requesting the window of
a view () with a nil
layer. This view probably hasn't received initWithFrame: or
initWithCoder:.'
I am not getting what is the exactly issue i have tried set delegate self or nil but nothing worked .
I think the error is with the view you are calling alert to appear is not initialised with frame rect, Could you please tell where you are calling it to appear
I have an action sheet that pops up on a view controller. That action sheet has 3 buttons, "Choose Existing Icon", "Take Picture", and Cancel.
I have the Take Picture button working just fine. However, I want the Choose Existing Icon button to link to a UITableViewController that has a list of premade icons that I will have seeded the application with. How do I go about linking the button to the table of icons?
I have tried this in the clickedAtButtonIndex method,
NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex];
if ([buttonTitle isEqualToString:#"Choose Existing Icon"])
{
IconViewController *iconPicker = [[IconViewController alloc] init];
[self presentViewController:iconPicker animated:YES completion:nil];
}
But this crashes. I want it to let the user see a table of icons and select one. Then have that icon show up in a UIImageView on the original controller.
Thanks for any help
EDIT
I'll change to buttonIndex, thanks for the tip on that. I followed a tutorial and didn't think much about it.
When I run the code as it is here, I get this error when I tap the "Choose Existing Icon" button.
2013-10-01 13:06:18.680 CardMinder[594:60b] * Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit/UIKit-2903.2/UITableView.m:6235
2013-10-01 13:06:18.684 CardMinder[594:60b] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
There is a method for calling functions at button touchs in uiactionsheet similar to uialertview
http://blog.mugunthkumar.com/coding/ios-code-block-based-uialertview-and-uiactionsheet/ ..... read this blog
I have two view controllers that both return to the home VC using
[self dismissModalViewControllerAnimated:NO];
One of them works and triggers it using a storyboard created button, whilst the one that doesn't work triggers it using a programmatically created button.
When the button on the second one is pressed it does move to the home VC, but instantly crashes
Update:
New Output
** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_questioner_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTYxYWQ0YjBlMTY1MGIwZjZlMDA5NDkxNmI2MzQxZmFhBjsAVA%3D%3D--15054ec7f94935cfc07bad559f1d52cd65ea5e4b: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled.
Key path: scoringData
Observed object:
It seems to crash when it gets to this point
+(void)processScoringData:(NSMutableData*)response
{
[DataStore dataStore].scoringData = [[NSMutableDictionary alloc]init];
After adding an exception break point I get this beside the output. Not sure if it helps?
ServerInterface
(Class) [0] = <error: unknown Class>
response = (NS MutableData*)
NSData NSData
NSObject NSObject
isa Class 0x3c35b9ac
[0] Class <error: unknown Class>
[self dismissViewControllerAnimated:NO completion:nil]; use instead of your dismiss controller method because your method is deprecated.
Definitely work for You.
I would like to have choosing images or videos as one option when taking photos or videos. When i seem to click the option, the app crashes. I am using ios 6 and it seems that apple has included some privacy issues when the app tries to search for existing images and videos. Besides that, should i still be using UIImagePickerControllerSourceTypeSavedPhotosAlbum or use something else?
Part of my code:
if (buttonIndex == 2) {
imgpPicker = [[UIImagePickerController alloc] init];
imgpPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
imgpPicker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie,(NSString *)kUTTypeImage,nil];
popOverView = [[UIPopoverController alloc] initWithContentViewController:imgpPicker];
[popOverView presentPopoverFromRect:self.view.bounds inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
The error that appears on the debugger is signal SIGABRT:
*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
*** First throw call stack:
(0x36a732a3 0x33e9a97f 0x36a731c5 0x3777d897 0x3777d6a1 0x3777d65b 0x3777ce1b 0x3777cb45 0x37735767 0x377355c7 0x377355c7 0x3772fe53 0x377177e5 0x377172cb 0x37b00b95 0x115313 0x378d6ccb 0x378000ad 0x3780005f 0x3780003d 0x377ff8f3 0x377ffde9 0x377285f9 0x37715809 0x37715123 0x3644d5a3 0x3644d1d3 0x36a48173 0x36a48117 0x36a46f99 0x369b9ebd 0x369b9d49 0x3644c2eb 0x37769301 0xe1763 0xe14c0)
libc++abi.dylib: terminate called throwing an exception
(lldb)
The privacy for the application is also set to ON in the settings.
Am i doing something wrong?
Any guidance or tips will be very helpful. Sorry if the question is very vague.. If need more information, I can provide...
In your code add:
- (BOOL)shouldAutorotate
{
return YES;
}
And go to the summary tab of your application and allow both portrait and landscape orientations.
Hey guys, just had a question about UIAlertViews.
I have a button within a cell, and I wish to push an object's data into the UIAlertView body section. Right now I have this:
- (void)locationButton:(id)selector{
NSString *addressBody = [NSString stringWithFormat:#"%#", [[testList objectAtIndex:selectedCellIndexPath.row] address]];
UIAlertView *addressView = [[UIAlertView alloc] initWithTitle:nil
message:addressBody
delegate:self
cancelButtonTitle:#"OK"
otherButtonTitles:#"Show on Map", nil];
[addressView show];
[addressView release];
}
Within the viewDidLoad, I initialized my Conference class like
testList = [[NSMutableArray alloc] init];
Conference *conf1 = [[Conference alloc] initWithConferenceId:110];
Conference *conf2 = [[Conference alloc] initWithConferenceId:130];
[testList addObject:conf1];
[testList addObject:conf2];
however when the button is pushed, the alert view does not display and it will eventually crash with
"Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Conference address]: unrecognized selector sent to instance 0x5e273a0'"
Any suggestions?
In your Conference class, there is no address method implemented.
This could just be a spelling mistake in the implementation. But it would be more helpful if you posted code in your Conference class.