-->

MPMusicPlayerController and setNowPlayingItem

2019-06-27 11:26发布

问题:

I'm using MPMusicPlayerController, specifically with setNowPlayingItem protocol and it's for cydia. But I have some issues and theos' warning when i make. It seems that some of the protocols and methods are not working and I receive some warning like this:

Tweak.xm:177: warning: ‘MPMusicPlayerController’ may not respond to ‘-skipToPreviousItem’
Tweak.xm:188: warning: ‘MPMusicPlayerController’ may not respond to ‘-pause’
Tweak.xm:193: warning: ‘MPMusicPlayerController’ may not respond to ‘-play’
Tweak.xm:201: warning: ‘MPMusicPlayerController’ may not respond to ‘-skipToNextItem’
Tweak.xm:317: warning: ‘MPMusicPlayerController’ may not respond to ‘-setNowPlayingItem:’

Have anyone some ideas? I enter the protocol already in prototype

回答1:

I don't think it's because of cydia - it sounds like a compilation issue.

Have you definitely got

#import <MediaPlayer/MediaPlayer.h>

in your file?



回答2:

have you added the MediaPlayer.framework to your project?

  1. select your project in the project navigator
  2. select your target on the right side
  3. select the "Build Phases" tab
  4. open "Link Binary With Libraries"
  5. add your framework