Howto use SBMediaController - always throws "Character not found"

I am trying to access SBMediaController, but my application just crashes. My goal is to stop playing any music application in the background using [[[SBMediaController] sharedInstance] stop]

I use private headers to access privateframeworks and can use GSLockDevice () to lock the screen, so I think my import should be found. I noticed that there is no SpringBoard.framework in privateframeworks, like GraphicServices.framework, maybe this is the problem? My mistake:

 dyld: Symbol not found: _OBJC_CLASS_$_SBMediaController Referenced from: /var/mobile/Applications/D1CB0D98-1858-406C-AF4B 254BBEA7A73D/iTest.app/iTest Expected in: flat namespace 
+4
source share
1 answer

You cannot contact SpringBoard. You should get the class at runtime using objc_getClass () as follows:

 SBMediaController *controller = [objc_getClass("SBMediaController" sharedInstance]; 

By the way, this will only work if your code works in SpringBoard (aka “tweak” or the MobileSubstrate extension). If your code is running in its own application (this is your case), you should use the MediaPlayer provided by Apple.

+2
source

All Articles