如何更改我的 iOS 应用程序的权限? [英] How do I change my iOS applications' entitlements?

查看:29
本文介绍了如何更改我的 iOS 应用程序的权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要运行以下代码来关闭我的 iphone 屏幕.

I need to run the following code to turn off my iphone screen .

在 iOS6 上:

void (*BKSDisplayServicesSetScreenBlanked)(BOOL blanked) = (void (*)(BOOL blanked))dlsym(RTLD_DEFAULT, "BKSDisplayServicesSetScreenBlanked");

然后使用:

BKSDisplayServicesSetScreenBlanked(1); // 1 to dim, 0 to undim

它不起作用.有人告诉我,我需要 com.apple.backboard.client 权限才能在我的 iphone 上使用它.我不知道如何设置这些权利.我见过几种设置权利的方法,但它们让我很困惑,就像这个一样.

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.

是的,您确实需要对权利进行代码签名.但是,不,它没有必须在越狱手机上使用 Apple 证书.你可以伪造代码签名,通过下载 ldid 可执行文件,然后执行

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

假设您的应用名为 MyAppName 并且您获得了权利文件 entitlements.xml.我相信这个权利文件会为你工作,如果你用 ldid 伪造代码签名.

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?

推荐答案

对于越狱应用/授权,你需要做这样的事情.首先,创建一个名为 entitlements.xml(或任何你喜欢的名字)的文件:

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>

如果需要,您可以添加更多权利.此示例文件仅授予应用 com.apple.backboard.client 权利.

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:

  1. 您需要修改 Xcode 的 SDKSettings.plist 文件,如下所示.CODE_SIGNING_REQUIRED 应设置为 NO.
  2. 请勿在 Xcode 中对您的应用进行代码签名.在构建设置中,确保代码签名标识设置为不要代码签名.
  3. 在您为 iOS 设备(不是模拟器!)构建您的应用程序之后,然后转到 Mac 上输出文件所在的目录.对于名为 HelloWorld 的应用程序,您正在查找 HelloWorld.app 文件夹.它可能因您的配置而异,所以我不会费心告诉您它在哪里.如果有疑问,请使用命令行 find 命令.
  4. 此位置下载预构建的ldid,或作为来自此处的来源.
  5. 将 entitlements.xml 文件复制到 HelloWorld.app 所在的同一目录中.(注意:您不必必须将它放在这里...如果您将它放在其他地方,只需调整我在下面向您展示的命令行即可).
  6. 将目录更改为 entitlements.xml 文件所在的目录.
  7. 使用此命令伪造代码签名:
  1. You will need to modify Xcode's SDKSettings.plist file, as shown here. CODE_SIGNING_REQUIRED should be set to NO.
  2. Do not code sign your app in Xcode. In Build Settings, make sure the code sign identity is set to Don't Code Sign.
  3. 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 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.
  4. Download ldid pre-built from this location, or as source from here.
  5. 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).
  6. Change directory to the directory where your entitlements.xml file is.
  7. Fake code-sign with this command:

$ldid -Sentitlements.xml HelloWorld.app/HelloWorld

在那之后,您需要传输整个 HelloWorld.app 文件夹才能在您的设备上安装该应用程序.有很多方法可以做到这一点,而且听起来您已经有办法了.

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.

注意:我没有说明此权利是否是用于 iOS 6 上的 BKSDisplayServicesSetScreenBlanked() 调用的正确权利.我还没有测试过.我确实知道此权利允许您在较低的 iOS 版本上使用 SBDimScreen().但是,这个答案只是对如何为越狱应用添加这种权利的描述.

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.

这篇关于如何更改我的 iOS 应用程序的权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆