Sean
Sean

Reputation: 1

Unrecognised selector sent to instance (iOS) - automaticallyWaitsToMinimiseStalling

Extremely fresh to objective c and I'm completely stumped by the error below. Any help or guidance would be extremely appreciated!

Exception '-[ReactPlayer setAutomaticallyWaitsToMinimizeStalling:]: unrecognized selector sent to instance 0x14e352500' was thrown while invoking prepare on target AudioPlayer with params...

Context: AVPlayer's status is unreliable, so the player is preparing for the actual audio is loaded. The player.automaticallyWaitsToMinimizeStalling property tells AVPlayer to play immediately instead of waiting until it can play through the entire file so I set this to false to try and fix this problem. Works just fine on the emulator, but when building on an iOS device I ran into the error above.

It relates to the following code:

 if (player.currentItem.status == AVPlayerStatusReadyToPlay) {
        player.automaticallyWaitsToMinimizeStalling = NO;
        callback(@[[NSNull null]]);
    } else {
        NSDictionary* dict = [Helpers errObjWithCode:@"preparefail"
                                         withMessage:[NSString stringWithFormat:@"Preparing player failed"]];

        if (player.autoDestroy) {
            [self destroyPlayerWithId:playerId];
        }   

        callback(@[dict]);
    }

Upvotes: 0

Views: 340

Answers (1)

Peter
Peter

Reputation: 2165

"unrecognized selector" means you're calling a method on an object that doesn't support that method, in this case, setAutomaticallyWaitsToMinimizeStalling. Your player object here is a ReactPlayer not an AVPlayer and my guess is that ReactPlayer does not implement the method setAutomaticallyWaitsToMinimizeStalling

Upvotes: 1

Related Questions