GoogleVR: Unrecognized selector sent to instance ('NSInvalidArgumentException')

I'm setting up a class to view video using Google VR. It runs without error using the sample code. When I copy the class and view controller over to my project, this error occurs:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setDelegate:]: unrecognized selector sent to instance 0x109d04d90'


Here's the relevant code:

@interface VideoPlayerViewController () <GVRVideoViewDelegate>
@property(nonatomic) IBOutlet GVRVideoView *videoView;
@property(nonatomic) IBOutlet UITextView *attributionTextView;
@end

_videoView.delegate = self;
_videoView.enableFullscreenButton = YES;
_videoView.enableCardboardButton = YES;
_videoView.enableTouchTracking = YES;


I can't figure out why it works in the sample code and not my project. It's the exact same code and everything is connected up in the storyboard. The UIView is a custom class of type GVRVideoView.


This is driving me crazy. Time sensitive. Please help!

Replies

Are you actually dying on line 6?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Yes, it is crashing on the setDelegate method. It crashes on any method call to videoView.

Yes, it is crashing on the setDelegate method.

It seems likely that you have the

videoView
outlet wired up to the wrong type of view. Note that message you got:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setDelegate:]:unrecognized selector sent to instance 0x109d04d90'

You’ve called

-setDelegate:
on an instance of UIView, and the only way that can happen on line 6 is if
videoView
is wired up to a UIView.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"