code signing entitlements

entitlements,全称 code signing entitlements。
在苹果官网链接如下:
https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AboutEntitlements.html
entitlements描述了binary需要用到哪些权限。

常规的权限包括iCloud、Game Center等,这些在XCode 5的Capabilities中都可以找到。查看更多公开的权限,请猛击此处
启用这些权限后,最后会在你的binary中有所体现,据说用十六进制编辑工具打开你的二进制文件,在结尾处就能看到,但我没有亲自验证哦。

在XCode中启用权限后,签名用的provisioning profile也必须启用相应的功能,否则签名失败。

还有一些系统(私有)权限,则是不公开的。以在iOS7下获取IMSI为例,必须具备com.apple.coretelephony.Identity.get权限。
这些权限需要你自定义entitlements xml文件,格式如下:

<?xml version="1.0" encoding="UTF-8"?>
<!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.coretelephony.Identity.get</key>
<true/>
</dict>
</plist>
然后,在XCode的code signing entitlements中填上该xml的路径。

在非越狱的iOS7设备上调试,签名时必须指定provisioning profile,而provisioning profile中必然没有授予com.apple.coretelephony.Identity.get这种权限,部署时便会报错。要是提交到appstore的包中包含了私有权限,那必然又会审核被拒,所以结论是:获取IMSI之类需要权限验证的功能在非越狱iOS7上无解。

越狱过的iOS7设备,装上AppSync,XCode build时选择不指定provisioning profileprovisioning profile指定不指定均可(但是如果你需要用推送或者IAP,那必须用profile),证书随便选开发者签名或者自签名,指定entitlements文件,即可成功获取IMSI。

其他的一些有用的权限:
后台发短信:

<key>com.apple.messages.composeclient</key>
<true/>
使用MobileInstallationInstall安装ipa:(from iOS6)

<key>com.apple.private.mobileinstall.allowedSPI</key>
<array>
<string>Install</string>
<string>Browse</string>
<string>Uninstall</string>
<string>Archive</string>
<string>RemoveArchive</string>
</array>
打开其他app:

1
2
<key>com.apple.springboard.launchapplications</key>
<true/>
1
<code>[[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.apple.Preferences" suspended:NO];</code>

如何获取更多私有权限的资料,要么Google,要么自己用ldid查看系统app的权限:

1
ldid -e xxx
你也可以用ldid给app附加entitlements:

1
2
cd MyAppName.app
ldid -Sentitlements.xml MyAppName
ldid和其他一些越狱开发有用的源码和资料可以在这里找到:

https://code.google.com/p/ios-toolchain-based-on-clang-for-linux/

该项目提供了一些预编译好的二进制文件,如果你的os匹配,那可以直接拿来用,不然的话你就要自己编译了。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容