Settings.bundle & keychain for applications from Cydia doesn't work

♀尐吖头ヾ 提交于 2019-12-11 11:26:26

问题


I'm working on app which is distributed with Cydia. So it is installed in /Applications folder, not /var/mobile/Applications/ as usual AppStore apps. And I assume that installation give me some huge problems. At first, keychain read & write with famous Apple's KeychainItemWrapper doesn't work at all. Also, my settings.bundle doesn't work too. App settings don't displayed in Settings.app.

When I test application in Simulator or even deploy it from Xcode to device directly (it is deployed to /var/mobile/Applications/) everything works like a charm.

I tried moving installed .app to var/mobile/Applications/XXXXXX/myapp.app with making mobile:mobile as it's owner. It didn't help.

Any solution for making this work?


回答1:


Settings Bundle

Settings work a little differently for jailbreak apps. You need to do something similar to the normal Settings.bundle, but there are differences.

See here for some information on that.

And here

And here

You should make your app depend on the preferenceloader package, which helps jailbreak apps manage Settings. So, you'll have something like this in your DEBIAN/control file:

package: com.mycompany.MyApp
Name: MyApp
Version: 2.2-2
Architecture: iphoneos-arm
Depends: preferenceloader
Description: Do something for jailbreak iPhones
...

Keychain

In order to make the keychain work for my app, I needed to add entitlements to my binary. The way I found out which entitlements were needed was to first build the app in the normal way (not a jailbreak app, just a normal 3rd-party app store app using Xcode). Then, I inspected the entitlements in the binary built by Xcode:

ldid -e MyApp.app/MyApp

And then spliced those entitlements into a new entitlements.xml file. See here for an example of applying entitlements. I believe the entitlements for your app should look something like this:

  <key>application-identifier</key>
  <string>L44W4W8ABC.com.mycompany.MyApp</string>
  <key>aps-environment</key>
  <string>development</string>
  <key>com.apple.developer.team-identifier</key>
  <string>L44W4W8ABC</string>

It's possible that this method of adding entitlements isn't necessary. See comments below your question for other options. However, I was adding other entitlements for other reasons, and could not do that through Xcode.



来源:https://stackoverflow.com/questions/11886362/settings-bundle-keychain-for-applications-from-cydia-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!