How do I change my iOS applications' entitlements?
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:
- You will need to modify Xcode's
SDKSettings.plist
file, as shown here.CODE_SIGNING_REQUIRED
should be set toNO
. - Do not code sign your app in Xcode. In Build Settings, make sure the code sign identity is set to Don't Code Sign.
- After you then Build your app for the iOS Device (not Simulator!), then go to the directory on your Mac where the output files are located. For an app named
HelloWorld
, you're looking for theHelloWorld.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 linefind
command. - Download
ldid
pre-built from this location, or as source from here. - Copy the entitlements.xml file into the same directory as where
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). - Change directory to the directory where your entitlements.xml file is.
- Fake code-sign with this command:
$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.
zzzzz
Updated on June 28, 2022Comments
-
zzzzz almost 2 years
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?
-
Nate over 11 years(-1) this answer is wrong, or woefully incomplete. This normal process for adding entitlements does not work for adding this kind of entitlement for a jailbreak app.
-
zzzzz over 11 yearsCan I get your skype id please? So I could email you next time I have a jailbreak type question
-
zzzzz over 11 yearsI cant sign it using ldid command.it says -bash: -Sentitlements.xml: command not found
-
Nate over 11 yearsI can't tell what the error message is, because you haven't used formatting. Please surround the exact output with tick marks (top left of most keyboards). It would also help if you showed exactly what command you tried (also formatted with code tick marks).
-
zzzzz over 11 yearsI am currently in the directory where screenoffios6.app is placed.entitlements file is also placed in the same directory where i run the command. Now the command I am using is
administrators-Mac-mini-3:debug-iphoneos me$ $ldid -s entitlements.xml screenoffios6.app/screenoffios6
It returns the following error-bash: -s: command not found
-
Nate over 11 yearsAnd, you really need to type the commands as I list them. The
-S
is uppercase, not lowercase, and there's no space between it andentitlements.xml
. -
zzzzz over 11 yearsOnce I put the ./ldid i get the following error
-bash: $./ldid: No such file or directory
I used the following command./ldid -Sentitlements.xml screenoffios6.app/screenoffios6
-
zzzzz over 11 yearsyou are right.I was accidentally typing a $ infront of the command.The command now works but I am getting the following message.
codesign_allocate: object: screenoffios6.app/screenoffios6 malformed object (unknown load command 10) util/ldid.cpp(584): _assert(0:WEXITSTATUS(status) == 0) Trace/BPT trap: 5
-
Nate over 11 yearsPlease navigate in Terminal to the directory where your build product is, and go into
screenoffios6.app/
. Inside that directory, issue the commandfile screenoffios6
and tell me what the output is (please surround by ticks in your comment). Also, which version ofldid
(which link I showed in my answer) did you use to getldid
? -
zzzzz over 11 yearsI used the first link to download ldid and file screenoffios6 returned the following output
screenoffios6: Mach-O executable arm
-
Nate over 11 yearsThat looks ok, in terms of being one architecture only. Can you run this command:
lipo -info screenoffios6
in the same directory? Your system might not havelipo
, but hopefully it does. -
zzzzz over 11 yearsI got this output
Non-fat file: screenoffios6 is architecture: armv7
-
Nate over 11 yearsThat should be good, too. At this point, I'm not quite sure what could be wrong. The only thing I can think of is to post your binary on some other site and link to it so I can download the
screenoffios6
executable, and trying signing it myself. I would only need the executable, not any of the other resources needed to run your app (Info.plist, icons, etc.). That's all I can think to suggest at this point. -
zzzzz over 11 yearsmac version is mac osx 10.7.5
-
Nate over 11 yearsMe, too. I dunno. That exact executable signs successfully for me. The only thing I can suggest is go back and try it again, taking care to type everything in exactly as I listed it. Or google for your error message ... similar error described here
-
Nate over 11 yearsAlso, maybe there's something I have installed that you don't. Try going to Xcode -> Preferences -> Downloads, and make sure Command Line Tools are installed.
-
Nate over 11 yearsOne more option is to not do
ldid
signing on your Mac, but transfer the unsigned executable to the device, along with the entitlements.xml file. Go into Cydia and search for ldid and install it on your phone. Then, at the (ssh) command line, navigate to where you install your app, and try theldid -Sentitlements.xml screenoffios6
command again, on the device. -
0x8BADF00D over 10 yearsI can confirm that it does not work for jailbreak app. (iOS 7.0.4)