1

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?

fuxia
  • 62,923
  • 6
  • 54
  • 62
albicelestial
  • 145
  • 2
  • 12
  • 1
    are you codesigning the app? the keychain api relies on the codesig – DanZimm Aug 10 '12 at 05:44
  • Yes, I signed the app but not with apple-provided certificate. I generated it by myself. If app was not codesigned it even didn't start on my device. – albicelestial Aug 11 '12 at 11:28
  • As I discovered, setup of entilements was required also with codesinging. So all the issued are resolved. Thanks 2 all. – albicelestial Aug 11 '12 at 12:09
  • @albicelestial how exactly did you get keychain access working on your JB app, as I am running into this exact same issue. – ipatch Aug 12 '12 at 00:19
  • Chris, you have to add entilements (select your project, scroll down to bottom in Summary and click on "Entilements" checkbox, then add Keychain Access Group if it was not added by default). After this manipulation KeychainItemWrapper works ok. – albicelestial Aug 13 '12 at 06:23

1 Answers1

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.

Community
  • 1
  • 1
Nate
  • 31,017
  • 13
  • 83
  • 207
  • Thank you, I assumed that PreferenceLoader is the only way to make it working. – albicelestial Aug 11 '12 at 11:27
  • @albicelestial, yep, PreferenceLoader is what I use for all my jailbreak apps. – Nate Aug 11 '12 at 12:17
  • Did "preferenceloader" help with the Keychain wrapper? – ipatch Aug 12 '12 at 00:18
  • @Chris, no, preference loader wouldn't help with that. I think he needed to add a separate entitlements xml file (and code sign that with `ldid -Sentitlements.xml`, too). [See the Apple docs](https://developer.apple.com/library/mac/#documentation/security/Reference/keychainservices/Reference/reference.html) about entitlements, and keychain access. – Nate Aug 12 '12 at 00:45