MPMoviePlayer crashing on getting out and in the app - ios

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.

Related

UISearchResultsUpdating getting crash when it s called

Hi I am using Apple CATALOG Source code for displaying search bar controller on navigation controller.
It does load, but when i click on search, it get crash due to UISearchResultsUpdating-
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AAPLSearchBarEmbeddedInNavigationBarViewController updateSearchResultsForSearchController:]: unrecognized selector sent to instance 0x15db8ab0'
Suggest me the reason for crash.
code for crash -
- (void)updateSearchResultsForSearchController:(UISearchController *)searchController {
if (!searchController.active) {
return;
}
self.filterString = searchController.searchBar.text;
}
Your error is self-explanative. You're crash is not on this method, but in place where you call it. You're sending message to a wrong object.

App crashes when pushing a view controler

Hey when I push another view Controller i get this in my main.m
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
I am using this to push the view controller -
-(void)showMore:(UIButton *)sender
{
MoreViewController *moreViewController = [[MoreViewController alloc] init];
[self.navigationController pushViewController:moreViewController animated:YES];
}
I am sending the message here
[moreButton addTarget:self action:#selector(showSettings:) forControlEvents:UIControlEventTouchUpInside];
Here is my Error -
2013-09-25 18:16:03.186 Time Travel[1591:60b] Application windows are expected to have a root view controller at the end of application launch
2013-09-25 18:16:05.179 Time Travel[1591:60b] -[NSConcreteValue showSettings:]: unrecognized selector sent to instance 0x14e5ea70
2013-09-25 18:16:05.181 Time Travel[1591:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteValue showSettings:]: unrecognized selector sent to instance 0x14e5ea70'
* First throw call stack:
(0x2e1e5e8b 0x384e26c7 0x2e1e97b7 0x2e1e80b7 0x2e136e98 0x309a055f 0x309a04fb 0x309a04cb 0x3098c0f3 0x3099ff13 0x3099fbdd 0x3099ac09 0x3096ff59 0x3096e747 0x2e1b0f27 0x2e1b03ef 0x2e1aebdf 0x2e119541 0x2e119323 0x32e492eb 0x309d01e5 0x4cbd5 0x389dbab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
Does it crash on the first line or the second? Add a breakpoint to each and click the continue button to check which one.
If it's the former there might be some illegal code in your alloc/init for MoreViewController.
If it's the latter, maybe there some class/delegate methods (viewDidLoad, etc) are the culprit.
What is the error message during your crash? (Sometimes clicking the resume-play-button in the debugger in Xcode can reveal a bit more after a crash.)
I didnt find a method named showSettings: in the code you posted. You are pushing your viewController in method named showMore: So I think, the code should be like this:
[moreButton addTarget:self action:#selector(showMore:) forControlEvents:UIControlEventTouchUpInside];
Please check with this.
The error message saying showSettings: method is not found
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteValue **showSettings:**]: unrecognized selector sent to instance 0x14e5ea70'
And I've notified that you are using showMore: as the name of your method
-(void)showMore:(UIButton *)sender
maybe just change showMore to showSettings, or vice versa

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.

ActionSheet Throws Unrecognized Selector Sent to Instance

I'm using Action Sheet Picket. I added .h and .m files as instructed in readme, picker and even cancelAction is working well but somehow successAction throws NSInvalidArgumentException with this message: "unrecognized selector sent to instance".
Application is a kind of tab bar application with Navigation Controller. There is a TabBarController as root and there are ViewControllers which are located under the TabBarController and one of the ViewControllers is a Navigation Controller. But I'm not getting this error in Navigation Controller. I'm not sure if this causes any error.
Here how I used:
- (IBAction)filterResult:(id)sender {
[ActionSheetStringPicker showPickerWithTitle:#"Pick Filter" rows:self.filterList initialSelection: self.selectedIndexes target:self successAction:#selector(animalWasSelected:element:) cancelAction:nil origin: self];
}
- (void)animalWasSelected:(NSNumber *)selectedIndex element:(id)element {
self.selectedIndexes = [selectedIndex intValue];
NSLog(#"Selected");
}
Yes that's all. I've already included ActionSheetPicker.h file and as I said picker is working fine.
Finally here is error:
[MYYViewController successAction:]: unrecognized selector sent to instance 0x9032400
2012-12-24 12:14:45.488 Example[54268:11303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MYYViewController successAction:]: unrecognized selector sent to instance 0x9032400'
Any help would be great.
Looks rather straight forward, you need to implement successAction: in your MYYViewController class, because the picker is not checking if it will respond or not and calling it directly.

parent-child unrecognized selector sent to instance

I have a subview, called DataViewController, and a parent viewcontroller, called RootViewController.
Everytime is try to call a function or set a property that is defined in my RootViewController, from my subview, I get these errors:
Error:
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[UIPageViewController
setDetailsDataObject:]: unrecognized selector sent to instance
0x6aa2df0'
Code:
RootViewController.h:
#property (strong, nonatomic) id detailsDataObject;
DataViewController.m:
((RootViewController *)self.parentViewController).detailsDataObject = self.dataObject;
And...
Error:
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[UIPageViewController
showDetails]: unrecognized selector sent to instance 0x6880db0'
Code:
RootViewController.h:
- (void)showDetails;
RootViewController.m:
- (void)showDetails
{
NSLog(#"Hello");
}
DataViewController.m:
[((RootViewController *)self.parentViewController) showDetails];
Does anyone know how to fix these exceptions?
do an Nsaasert statement to check if the self.parentViewController is actually RootViewController instance
NSAssert([self.parentViewController isKindOfClass:[RootViewController class]], #"Not RootViewController");
Try this..correct if there are any spelling mistakes.

Resources