iphoneobjective-ciosjailbreakcydia

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


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?


Solution

  • 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.