Private API Failed on iOS? Try to check entitlements settings.

  • 3229
  • 0

摘要:Private API Failed on iOS? Try to check entitlements settings.

在编写一些使用私有API的例子中,发现一些程序在执行过程中会出现一些莫名其妙的错误,比如没有返回或者什么的,这些很多都是在过去测试通过,但是现在却不行了。比如我们之前提到过的GDB调试问题

苹果官方文档也有关于entitlements文件的描述,可以参见: Entitlement Key Reference

但是对私有API来说,很多权限并没有开放文档资料,那么怎么获取呢?

方法如下:

ldid -e <程序>

查看对应的权限。比如,下面就是SpringBoard的权限列表:

<?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>allow-obliterate-device</key>
	<true/>
	<key>application-identifier</key>
	<string>com.apple.springboard</string>
	<key>aps-connection-initiate</key>
	<true/>
	<key>checklessPersistentURLTranslation</key>
	<true/>
	<key>com.apple.CommCenter.Preferences-delete</key>
	<true/>
	<key>com.apple.MobileInternetSharing.allow</key>
	<true/>
	<key>com.apple.SystemConfiguration.SCDynamicStore-write-access</key>
	<true/>
	<key>com.apple.SystemConfiguration.SCPreferences-write-access</key>
	<array>
		<string>com.apple.AutoWake.xml</string>
		<string>preferences.plist</string>
		<string>com.apple.radios.plist</string>
	</array>
	<key>com.apple.aosnotification.aosnotifyd-access</key>
	<true/>
	<key>com.apple.assistant.client</key>
	<true/>
	<key>com.apple.backboard.client</key>
	<true/>
	<key>com.apple.bulletinboard.observer</key>
	<true/>
	<key>com.apple.bulletinboard.settings</key>
	<true/>
	<key>com.apple.bulletinboard.systemstate</key>
	<true/>
	<key>com.apple.bulletinboard.utilities</key>
	<true/>
	<key>com.apple.cards.all-access</key>
	<true/>
	<key>com.apple.coremedia.allow-protected-content-playback</key>
	<true/>
	<key>com.apple.coretelephony.CTVoiceSupport.allow</key>
	<true/>
	<key>com.apple.iapd.accessibility</key>
	<true/>
	<key>com.apple.imagent.av</key>
	<true/>
	<key>com.apple.imagent.chat</key>
	<true/>
	<key>com.apple.itunesstored.private</key>
	<true/>
	<key>com.apple.keystore.device</key>
	<true/>
	<key>com.apple.locationd.authorizeapplications</key>
	<true/>
	<key>com.apple.locationd.effective_bundle</key>
	<true/>
	<key>com.apple.locationd.prompt_behavior</key>
	<true/>
	<key>com.apple.locationd.status</key>
	<true/>
	<key>com.apple.managedconfiguration.mdmd-access</key>
	<true/>
	<key>com.apple.managedconfiguration.profiled-access</key>
	<true/>
	<key>com.apple.mediastream.mstreamd-access</key>
	<true/>
	<key>com.apple.messages.composeclient</key>
	<true/>
	<key>com.apple.mobile.deleted.AllowFreeSpace</key>
	<true/>
	<key>com.apple.mobilemail.mailservices</key>
	<true/>
	<key>com.apple.multitasking.systemappassertions</key>
	<true/>
	<key>com.apple.multitasking.termination</key>
	<true/>
	<key>com.apple.private.accounts.allaccounts</key>
	<true/>
	<key>com.apple.private.allow-webviewcontroller</key>
	<true/>
	<key>com.apple.private.hid.manager.client</key>
	<true/>
	<key>com.apple.private.icfcallserver</key>
	<true/>
	<key>com.apple.private.imavcore.imavagent</key>
	<true/>
	<key>com.apple.private.imcore.imremoteurlconnection</key>
	<true/>
	<key>com.apple.private.kernel.jetsam</key>
	<true/>
	<key>com.apple.private.librarian.can-get-application-info</key>
	<true/>
	<key>com.apple.private.mobileinstall.allowedSPI</key>
	<array>
		<string>Uninstall</string>
		<string>SetCapabilities</string>
		<string>Lookup</string>
	</array>
	<key>com.apple.private.tcc.allow</key>
	<array>
		<string>kTCCServiceAddressBook</string>
		<string>kTCCServiceCalendar</string>
		<string>kTCCServiceReminders</string>
		<string>kTCCServicePhotos</string>
	</array>
	<key>com.apple.private.ubiquity-kvstore-access</key>
	<array>
		<string>com.apple.weather</string>
		<string>com.apple.stocks</string>
	</array>
	<key>com.apple.remotenotification.access</key>
	<true/>
	<key>com.apple.remotenotification.preferences</key>
	<true/>
	<key>com.apple.springboard.activateawayviewplugins</key>
	<true/>
	<key>com.apple.springboard.opensensitiveurl</key>
	<true/>
	<key>com.apple.timed</key>
	<true/>
	<key>com.apple.videoconference.allow-conferencing</key>
	<true/>
	<key>com.apple.wifi.manager-access</key>
	<true/>
	<key>keychain-access-groups</key>
	<array>
		<string>apple</string>
		<string>com.apple.preferences</string>
	</array>
	<key>vm-pressure-level</key>
	<true/>
</dict>
</plist>

如果想签署一个和SpringBoard同样权限的软件,则可以保存这个plist,然后使用:

ldid -S[entitlements.xml] <binary>

签署一下就可以了

 

 

------------------------------

文章的授權使用CC BY-ND2.5協議。凡是標示“轉載”的文章,均來源於網絡並儘可能標註作者。如果有侵犯您的權益,請及時聯繫刪除或者署名、授權。


Gtalk/Email: cmd4shell  [at]  gmail.com