[Mono-bugs] [Bug 651455] New: MonoTouch.UIKit.UIEvent.SubType property throws exception

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Nov 4 14:58:15 EDT 2010



           Summary: MonoTouch.UIKit.UIEvent.SubType property throws
    Classification: Mono
           Product: MonoTouch
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Class Libraries
        AssignedTo: gnorton at novell.com
        ReportedBy: borislav.parvanov at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US)
AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.28 Safari/534.10

According to "Event Handling Guide for iOS" document, in order to handle
Remote-Control Events we need to do the following:

"To receive remote-control events, the view or view controller managing the
presentation of multimedia content must be the first responder. It (or some
other object in the application) must also tell the application object that it
is ready to receive remote-control events.

To make itself capable of becoming first responder, the view or view controller
should override the UIResponder methodcanBecomeFirstResponder to return YES It
should also send itself the becomeFirstResponder at an appropriate time, such
as (for view controllers) in an override of the viewDidAppear: method. Listing
5-1 shows this call and also shows something else: The view controller calls
the beginReceivingRemoteControlEvents method of UIApplication to “turn on” the
delivery of remote-control events.


To handle remote-control events, the first responder must implement the
remoteControlReceivedWithEvent: method declared by UIResponder. The method
implementation should evaluate the subtype of each UIEvent object passed in and
send the appropriate message to the object presenting the audio or video

So in my view controller I have these:

        public override void ViewDidAppear (bool animated)
            base.ViewDidAppear (animated);

        public override bool CanBecomeFirstResponder {
            get {
                return true;

        public override void RemoteControlReceived (UIEvent theEvent)
            if (theEvent.Type == UIEventType.RemoteControl)
                switch (theEvent.Subtype)
                case UIEventSubtype.RemoteControlNextTrack:
                case UIEventSubtype.RemoteControlPreviousTrack:
                case UIEventSubtype.RemoteControlPlay:
                case UIEventSubtype.RemoteControlPause:

Then I followed these instructions:
"You can test your application’s receipt and handling of remote-control events
by using the Now Playing Controls. These controls are available on recent
models of device (for iPhone, iPhone 3GS and later) that are running iOS 4.0 or
later. To access these controls, double-press the Home button, then flick left
or right along the bottom of the screen until you find the audio playback
controls. These controls send remote-control events to the application that is
currently or was most recently playing audio; the icon to the right of the
playback controls represents the application."

However, when I run my app, double press the Home button, flick left to the
audio playback controls and press one of the audio control buttons
(play/next/prev) the application stops with the following exception:

MonoTouch.Foundation.MonoTouchException has been thrown

"Objective-C exception thrown. Name: NSInvalidArgumentException Reason: 
- [UIRemoteControlEvent subType]: unrecognized selector sent to instance

I hope you fix it very soon. 

Sorry for my bad english.

Thank you

Reproducible: Always

Steps to Reproduce:

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list