MPMoviePlayerController crashing and not playing movie - ios

I am trying to play a movie using MPMoviePlayerController. When I call play method, i am getting following crash.
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <MPAVController 0x15786750> for the key path "currentItem" from <MPAVPlaylistManager 0x15787750> because it is not registered as an observer.'
*** First throw call stack:
(0x2f148ed3 0x391716c7 0x2f148e15 0x2fa7227f 0x2fa71ca7 0x30393977 0x3038d5ef 0x303889d5 0x3036a36b 0x3036c6bb 0x2f10ae79 0x2f07eb81 0x2fa463c5 0x2fa4acc7 0x303ef943 0x39672103 0x396720ef 0x396749a9 0x2f1135b9 0x2f111e85 0x2f07c541 0x2f07c323 0x33b10343 0x316957b5 0x3a719 0x3a6a0)
libc++abi.dylib: terminating with uncaught exception of type NSException
I am not sure whats happening, as I dont have setup any KVO observer for currentItem from MPAVPlaylistManager which is an internal class.
anybody else got this issue?

Your app is massing with MPMoviePlayerController instance that was created. I had the same issue a while back and As far as i can think of there can be two things 1. You are changing contentURL of the instance that you have created while playing a video 2.you are incorrectly releasing the instance of MPMoviePlayerController.

I resolved the issue, the problem was related to iOS7 (that is under NDA at the moment). AVPlayer behaviour is changed if the player is started from a secondary thread. the player object will be nil. fixed my issue.

Related

how to solve 'Object has been deleted or invalidated.' Realm exception

i have different realm objects in different ViewControllers and from my settingViewController i'm deleting all the data of app (the realm stored objects ) its working fine but when i move back to those viewControllers i got this exception :
Terminating app due to uncaught exception 'RLMException', reason: 'Object has been deleted or invalidated.'
*** First throw call stack:
(0x180c0adb0 0x18026ff80 0x100a13e7c 0x1001bd54c 0x1001be77c 0x1860c288c 0x1860c2c3c 0x185eb78e8 0x185d775b4 0x185eb6d34 0x192375f40 0x185ef1c94 0x192375ccc 0x1001b97ac 0x1001bbe4c 0x1860bf030 0x1860bf198 0x1860ae298 0x1860c3c64 0x185e548c4 0x185d641e4 0x1836f698c 0x1836f15c8 0x1836f1488 0x1836f0ab8 0x1836f0818 0x1836e9ddc 0x180bc0728 0x180bbe4cc 0x180bbe8fc 0x180ae8c50 0x1823d0088 0x185dd2088 0x100121cc8 0x1806868b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
i know its happening because system (kernel , iOS) dont knows that i've deleted those Realms Objects and system is trying to use that data which is not exists anymore (Correct me if i'm wrong) , any one can guide me on how i can fix this problem ???
I suggest you to make notification before deleting all your data to all view controllers, that manipulate with it:
Push notification from your settingViewController before wipe
Subscribe to this everywhere you need to clear objects.
delete references
perform clean in your settingViewController.
Or, other way - implement delegate pattern for your purpose. The idea is the same.
Hope this helps.

Why Today Notification Widget crashes at startup?

Today Notification Widget launch crashes with the following error:
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '*** setObjectForKey: object
cannot be nil (key: <__NSConcreteUUID 0x170026460>
C492718F-C23C-4FC8-AE0F-ED5CE3141xxx)'
ViewDidLoad not even gets called
Any idea why?
Check if NotificationCenter.framework is included into your project's current selected target or if there is any other framework missing.
It sounds like you're trying to write a nil value into a dictionary or NSUserDefaults. Your controller will be initialized before viewDidLoad is called. Did you override the initializer?
I think you need to provide more information. Maybe post your controller code?

Connecting ViewController causes SpriteKit to terminate app

I have a SpriteKit game, but now I'm working on making a menu. I decided to try to make these menus in a normal way, using Storyboards and UIViewControllers.
However, this is proving to be very difficult.
I added a new UIViewController, and set it as the initial viewcontroller. This causes no problems. However, as soon as I hook this up to a completely basic UIViewController file (FirstMenuViewController.m), with no edits or additions, ViewController.m seems to freeze up at if(!skView.scene){.
I'm getting this error:
-[UIView scene]: unrecognized selector sent to instance 0x170164980
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView scene]: unrecognized selector sent to instance 0x170164980'
*** First throw call stack:
(0x187f7f100 0x1944881fc 0x187f83db4 0x187f81ae0 0x187ea178c 0x1001012ec 0x18af42f90
....
libc++abi.dylib: terminating with uncaught exception of type NSException
What I don't get is why ViewController.m is even called, as there is no connection to that file from my FirstMenuViewController which is set as the initial viewcontroller.
Could someone please explain to me what is going on here?
Turns out I was subclassing the ViewController supplied by the SpriteKit-template instead of UIViewController when creating my FirstMenuViewController

iOS Button Target Actions with Block Crashes

I'm implementing UIButtons with block actions set on them for connivence and speed of integration. I've used this method before, a while ago now, and had little issue with it. Now, however, i'm facing an issue where integrating...
https://gist.github.com/2468899
... into my app now crashes it on launch. The error i'm receiving is as follows...
2012-09-27 22:18:47.459 flink[12174:907] -[UIButton setAction:withBlock:]: unrecognized selector sent to instance 0x1e8ae610
2012-09-27 22:18:47.460 flink[12174:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setAction:withBlock:]: unrecognized selector sent to instance 0x1e8ae610'
*** First throw call stack:
(0x3885a3e7 0x333bf963 0x3885df31 0x3885c64d 0x387b4208 0xea477 0xff6af 0x36b92cb1 0x3882f8f7 0x3882f15d 0x3882df2f 0x387a123d 0x387a10c9 0x3868c33b 0x34014289 0xe7b8f 0xe7b30)
libc++abi.dylib: terminate called throwing an exception
... i've never seen this issue before but it's odd that it is immediately crashing without any interaction.
Thanks in advanced.
You must make sure to add the implementation file of the category to your target. In Xcode, go to the File Inspector and make sure the Target Membership checkbox for your target is checked.

Unity iOS game crashing with NSInternalInconsistencyException

I am using Prime31's GameCenter Turn Based plugin in my game in order to handle online matches. A problem arises when I receive an "invitation to play" notification from Game Center while Game Center's matchmaker is showing (called using the plug-in => GameCenterTurnBasedBinding.findMatch(2,2,false); ).
The app crashes and the following output is shown in Xcode:
2012-08-20 08:39:27.050 Cabrais[1808:707] *** Assertion failure in -[NSIndexPath row], /SourceCache/UIKit/UIKit-1914.85/UITableViewSupport.m:2606
2012-08-20 08:39:27.052 Cabrais[1808:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid index path for use with UITableView. Index paths passed to table view must contain exactly two indices specifying the section and row. Please use the category on NSIndexPath in UITableView.h if possible.'
*** First throw call stack:
(0x355ec88f 0x33210259 0x355ec789 0x349e03a3 0x32d4d673 0x35dba49d 0x35dd90e5 0x35dd9379 0x32d4cefb 0x32d4bfd9 0x32d4b763 0x35da7657 0x32ceff37 0x3554b1fb 0x32716aa5 0x327166bd 0x327165c9 0x35dd8179 0x35da936b 0x35dbce65 0x35dbb6b3 0x33979c59 0x33984e91 0x355bf2ad 0x355424a5 0x3554236d 0x332dd439 0x32d1acd5 0x6954 0x3388)
terminate called throwing an exception(lldb)
I have tried disabling notifications through the Ipad/Iphone settings for both my app and GameCenter as well as through the code by removing all notification related code but this hasn't had any effect at all.
I know through debugging that the code in my function attached to GameCenterTurnBasedManager.handleTurnEventEvent doesn't get called before the crash occurs, and neither does the one registered to EtceteraManager.remoteNotificationReceived. (Both these function work perfectly fine otherwise.)
I have asked Prime31 and they have told me that the exception is a mishandling of the tables data source, and to file a bug report with Apple.
Has anyone experienced a similar crash/error while working with Unity?
And is there any way I can try to catch the notification before it arrives and remove the matchmaker or be able to handle the error from unity?
Any insight/help/comments would be greatly appreciated,
Thanks.

Resources