BlocksKit crashing on Open In Dialogue - ios

I have a view controller opening an 'Open-In' dialogue via a bar button item.
Calling code:
UIDocumentInteractionController *docInteraction = [[UIDocumentInteractionController alloc] init];
docInteraction.URL = location;
docInteraction.delegate = self;
if ([docInteraction presentOpenInMenuFromBarButtonItem:self.openInButton animated:YES])
self.openInController = docInteraction;
Dismissal code:
UIDocumentInteractionController *openIn = self.openInController;
if (openIn) {
[openIn dismissMenuAnimated:animated];
self.openInController = nil;
popupsDismissed = YES;
}
Sometime after the code is dismissed, the app crashes with this exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[A2DynamicUIPopoverControllerDelegate popoverController:animationCompleted:]: unrecognized selector sent to instance 0x1f82b4f0'
This is a BlocksKit defined interface, but I'm not using a BlocksKit class in thie particular case. 0x1f82b4f0 is a <A2DynamicDelegate: 0x1f82b4f0; protocol = UIPopoverControllerDelegate> but why BlocksKit is involved here at all is a mystery. Can someone give me some insight on how to fix the exception?

BlocksKit is a bit of a red herring. The dismissal code is deallocating the UIDocumentInteractionController too early here:
self.openInController = nil;
At the earliest, the deallocation should happen after the -documentInteractionControllerDidDismissOpenInMenu: delegate callback method.

Related

MPMoviePlayer crashing on getting out and in the app

I get this error:
-[MPInlineVideoFullscreenViewController player]: unrecognized selector sent to instance 0x15e63fe90
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MPInlineVideoFullscreenViewController player]: unrecognized selector sent to instance 0x15e63fe90'
Using iOS 8, the language is Objective-C. But I have this same code in the if statement like this in applicationDidBecomeActive and it does not crash:
UIViewController *vc = ((UINavigationController*)self.window.rootViewController).visibleViewController;
if([vc isKindOfClass:[VideoViewController class]]) {
VideoViewController *vca = vc;
if(vca.player.playbackState == MPMoviePlaybackStatePaused){
[vca.player play];
}
But if I use it on the different MPMoviePlayer, and it is fullscreen. I switch to a different app, and back, it crashes. Buy why not with the other movie controller. Also, the other one does not show any playback controls, while this one which crashes does.

App getting crashed when video is entered in full screen mode in iOS

I have an application where I am displaying a video on a view. But when the video is displayed it is getting crashed when I click on the full screen mode in iOS. This is my code:
-(void)viewDidLoad
{
MPMoviePlayerController *mc = [[MPMoviePlayerController alloc] initWithContentURL:nil];
mc.shouldAutoplay = NO;
mc.controlStyle = MPMovieControlStyleEmbedded;
NSURL *contentURL = [[NSBundle mainBundle] URLForResource:#"01 01. Welcome" withExtension:#"mov"];
mc.contentURL = contentURL;
[mc prepareToPlay];
mc.view.frame = self.test.bounds;
[self.test addSubview:mc.view];
self.testvideo = mc;
testvideo.fullscreen=YES;
}
I am adding player controller on to another view named test. When I click on the full screen buttons the app is getting crashed displaying error messages:
-[UIView trackRectForBounds:]: unrecognized selector sent to instance 0xa171ec0
2013-09-03 15:49:35.178 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView trackRectForBounds:]: unrecognized selector sent to instance 0xa171ec0'
Not sure why your app is crashing in the code snippet you've provided because the trackRectForBounds method is found on the UISlider class. Are you using a slider anywhere in your app ?
I'd suggest you to try the MPMoviePlayerViewController class instead of the MPMoviePlayerController class.
You can refer to this SO question for more details.

app crashes when changing viewcontroller

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.

Objective C - -[__NSCFString _isAncestorOfFirstResponder] Error

I'm trying to create this application, when you press on a tablecell you get shown the ViewController, and the variable get's set in the other view controller. Although i'm getting a few errors when i press the uitablecell.
Error:
2013-04-06 22:47:25.970 iFSX Guide[1069:907] Called
2013-04-06 22:47:26.009 iFSX Guide[1069:907] -[__NSCFString _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x1d562390
2013-04-06 22:47:26.016 iFSX Guide[1069:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x1d562390'
*** First throw call stack:
(0x319b22a3 0x3964c97f 0x319b5e07 0x319b4531 0x3190bf68 0x33832beb 0x338a837f 0x338548fb 0x33a95619 0x338a79b9 0x338a5fe7 0x339c83ef 0xa22a5 0x3387c28d 0x338fef81 0x322c0277 0x319875df 0x31987291 0x31985f01 0x318f8ebd 0x318f8d49 0x354ba2eb 0x3380e301 0xa19d1 0x39a83b20)
libc++abi.dylib: terminate called throwing an exception
The code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)in dexPath{
NSLog(#"Called");
Aircraft = indexPath.row;
[self performSegueWithIdentifier:#"ToSections" sender:self];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:#"ToSections"]){
AirplaneSections *sections = (AirplaneSections *)segue.destinationViewController;
sections.plane = Aircraft;
}
}
I've found out that it's an error on ViewDidLoad on the viewcontroller.
NSString *quickTemp = [NSString alloc];
switch (plane) {
case 0:
quickTemp = #"Boeing 737-800";
break;
default:
break;
}
TitleLabel.text = quickTemp;
*/
I'm doing something wrong there.
Are you using ARC? This sort of problem usually indicates there's a memory error somewhere. Basically, some code somewhere is trying to access an object that was already released. This makes everything go kaboom.
If you aren't using ARC, you should turn it on.
After that, the next thing you should do is run the static analyzer. Fix anything that comes up.
If that doesn't fix the problem, in Xcode, add a breakpoint that stops when an Objective-C exception is thrown. It should show you where exactly this problem is happening.
If that doesn't help, run your code under Instruments' and the Zombie tool. This will show you exactly where you tried to access memory that was already released.

Crasher in a custom view as UINavigationControllers navigationItem.titleView

I have an UIViewController with several subviews in its view property (UISearchbar and several UIButtons). The UIButtons hooked up to typical IBActions like -(IBAction)buttonPressed:(id)sender for the UIControlEventTouchUpInside state - it doesn't matter if I do it in IB or programmatically.
- (void)viewDidLoad {
MUZTitleViewController *title = [[MUZTitleViewController alloc]
initWithNibName:nil bundle:nil];
self.navigationItem.titleView = title.view;
}
In my project there's also an UINavigationController. When I set the navigationItem.titleView of the UINavigationBar to the view of my UIViewControllers view I get an EXC_BAD_ACCESS exception, as soon as I tap one of the button. I don't know why this is.
I uploaded a small sample project to illustrate my problem: Test010.xcodeproj (it's ARC enabled)
More and more I come to the conclusion that it's not a good idea to use the UIViewControllers view and assign it to the titleView but I don't see any alternative here.
Edit: Sorry, the sample project commented out the call which causes the exception. I reuploaded the linked project file.
Edit^2: As PengOne pointed out I've skipped the exact error message I got:
2011-09-10 23:09:50.621 Test010[78639:f803] -[CALayer buttonPressed:]: unrecognized selector sent to instance 0x9254ae0
2011-09-10 23:09:50.623 Test010[78639:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer buttonPressed:]: unrecognized selector sent to instance 0x9254ae0'
Have you tried setting NSZombieEnabled to YES? If I do this, the console shows the following output:
2011-09-10 22:56:23.329 Test010[6481:ef03] *** -[MUZTitleViewController
performSelector:withObject:withObject:]: message sent to deallocated
instance 0x7a7ff70
As the project is ARC enabled, the controller seems to get deallocated some time after this line:
MUZTitleViewController *title = [[MUZTitleViewController alloc] initWithNibName:nil bundle:nil];
I am not sure what the best solution is, but a property definitely helps to prevent the exception like so:
// MUZDetailViewController.h
#property (strong, nonatomic) MUZTitleViewController *title;
// MUZDetailViewController.m
#synthesize title;
self.title = [[MUZTitleViewController alloc] initWithNibName:nil bundle:nil];
self.navigationItem.titleView = title.view;
The problem that you were having with ARC can also be resolved by setting the initial view controller of your application as your main window's rootViewController property instead of using addSubview.
Doing this avoids the need to add each custom view controller as a property.

Resources