I need to run the following code to turn off my iphone screen .
On iOS6:
void (*BKSDisplayServicesSetScreenBlanked)(BOOL blanked) = (void (*)(BOOL blanked))dlsym(RTLD_DEFAULT, "BKSDisplayServicesSetScreenBlanked");
and then use:
BKSDisplayServicesSetScreenBlanked(1); // 1 to dim, 0 to undim
It doesnt work. Somebody told me that I need com.apple.backboard.client
entitlements for this to work on my iphone. I dont know how to set these entitlements. I have seen several ways to set entitlements but they are very confusing to me, like this one.
Yes, you do need to code sign the entitlements. But, no, it doesn't have to be with an Apple certificate on jailbroken phones. You can fake code sign, by downloading the ldid executable, and doing
cd MyAppName.app ldid -Sentitlements.xml MyAppName
assuming your app is named MyAppName and you made the entitlements file entitlements.xml. I believe that this entitlements file would work for you, if you fake code-signed it with ldid.
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0">
<dict>
<key>com.apple.backboard.client</key>
<true/>
</dict>
</plist>
Even with the above method, where do i place the above entitlements file?
For a jailbreak app/entitlement, you need to do something like this. First, create a file named entitlements.xml
(or whatever you like):
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.backboard.client</key>
<true/>
</dict>
</plist>
You can add more entitlements if you need. This example file just grants the app the com.apple.backboard.client
entitlement.
It doesn't really matter where you put this file. The key is:
SDKSettings.plist
file, as shown here. CODE_SIGNING_REQUIRED
should be set to NO
.HelloWorld
, you're looking for the HelloWorld.app
folder. It can differ depending on your configuration, so I won't bother trying to tell you where that is. If in doubt, use the command line find
command.ldid
pre-built from this location, or as source from here. HelloWorld.app
is. (Note: you don't have to have it here ... if you put it somewhere else, just adjust the command line I show you below).$ldid -Sentitlements.xml HelloWorld.app/HelloWorld
After that point, you'll need to transfer the entire HelloWorld.app folder to install the app on your device. There's many ways to do that, and it sounds like you already have a way.
I have this whole process setup with a script, to make it easier.
Note: I am not stating whether or not this entitlement is the correct entitlement to use for the BKSDisplayServicesSetScreenBlanked()
call on iOS 6. I haven't tested that. I do know that this entitlement works to allow you to use SBDimScreen()
on lower iOS versions. But, this answer is just a description of how to add this kind of entitlement for a jailbreak app.