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

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?

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.

Related

what is the use of entitlement and how it can be created?

I have created a small app which I have not used any .entitlement file for running in both simulator and device. Its working fine too...But I don't know where this .entitlement file is used and how it can be created.Is it important for the app?
Entitlements are special rights with which an application can gain additional privileges and access to certain functions of the system, such as access to the keychain (keychain-access-groups entitlement), launching applications just like SpringBoard does (com.apple.springboard.launchapplications entitlement), and so on.
An Entitlements.xml file is used when codesigning an application, both by the official codesign_allocate tool that comes with Xcode and the developer tools, and by the ldid utility that can be used for fake codesigning on jailbroken devices. Essentially, it's a property list file which contains one or more of these entitlements and whose contents will be merged into the executable during the codesigning process. When the OS attempts to run the application, and it looks for the signature of the binary, it finds the now-hardcoded entitlements file, and instructs the sandbox daemon to lift certain bans of privileges accoring to the contents of that file.
Here are all documented entitlements for iOS, other undocumented ones can also be found by looking at some excutable files in iOS.

Where does the compiled .ipa reside when I compile and deploy the app for the iOS simulator from Xcode?

I'd like to be able to pass around the version of my iphone application that was compiled for the simulator. The idea here is to be able to give copies of the app to different vms where they would deploy the app to the iOS simulator and run some tests.
But after I compile the app for the iOS simulator, I can't find the darn *.ipa. Does anyone know where it resides?
There’s no .ipa—Xcode copies the .app bundle by itself into the simulator. You can check:
~/Library/Developer/Xcode/DerivedData/YourProject-<some garbage>/Build/Products/Debug-iphonesimulator/
(swap Debug for Release if you’re looking to distribute a release build, obviously), or, alternately, get the version that’s actually installed in the simulator from:
~/Library/Application Support/iPhone Simulator/<OS version>/Applications/<some UUID>/.
You can copy that app bundle into another simulator by creating an arbitrarily-named folder in the above Applications directory and placing the .app inside it.
You can see where it is putting your build products by looking on:
Xcode Menu-> Preferences-> Locations
Or if you have project Specific settings they will be found by looking on
Xcode Menu-> File-> Project Settings
I think it builds the ipas from the products in those locations and loads them into the simulator. So you might not find an actual .ipa there you find .app in these locations.
If you want an ipa. Do an Archive build.
Do an Ad Hoc distribution and save the resulting .ipa to your desktop.
have you already tried the following location???
Library/Developer/Xcode/DerivedData

iOS: the executable was signed with invalid entitlements

So I've inherited development work for another users iOS application, and am doing my best to be able to make a working IPA file for it. I've been trying for the better part of 7 hours fighting with provisioning profiles, Entitlements errors, etc trying to get my .ipa file to install correctly, but have yet to do so. Recently I was able to get the application on my physical device by just pressing run and allowing it to deploy that way (this means that the provisioning profile and the device are all set up to work for the application, right?). Whenever I build the archive file and and distribute it as an .ipa file and try to install this .ipa through either itunes or the Iphone Configuration Utility, however, I continue to get the "The executable was signed with invalid entitlements" error. Is something wrong with my schemes or...? I think if I can't get it working soon I'm going to reinstall xcode, and clear out all my certificates, devices, provisions and just restart from square one.
This is an older project so it still had an Entitlements.plist file with it, which I've read is now longer used in xcode 4.x. I've made sure that the filepath for it isn't referenced, but should I just delete it?
I apologize if this issue has come up before, but this seems like an error message that gets spit out for a variety of reasons.
In my case, using correct provisioning profile(including device UDID), but Build Configuration was set to "Release".
So, after setting to "Build", it works.

iPhone distribution provisioning problem

I'm trying to distribute my iPhone application and doing everything like in apple's manuals. And finally, there is no embedded.mobileprovision in MyApp.app. And also there is nothing about it in Built results. I followed all the recommendations (like clean all targets, clear CodeSign identity, remove all build directories and launch xCode again) and still have no progress.
What am i doing wrong?
There is one more thing i'd like to ask about. In Distribution configuration I've added Entitlements.plist, but builder shows me a warning:
CodeSign warning: entitlements are not applicable for product type 'Application' in SDK 'Device - iPhone OS 3.1.2'; ignoring...
May be these two things are connected with each other?
For distribution on the AppStore, you need not to have an Entitlements file.

Testers unable to install application

I've sent my iphone application to my testers and all but one complain that the get error OxE8003FFE when they sync their devices. They are not able to install and run the application.
I'm using an ad hoc distribution provisioning profile and all of the testers devices are included in the profile.
I'm not sure how to proceed and would really appreciate any help you might be to give.
One more interesting bit of information: The program is a universal iPad/iPhone application. My testers are able to install it on their iPads but not their iPhones.
Did you properly add entitlements.plist, and uncheck the box therein?
I would recommend having one device locally that you deploy to through iTunes (not building through XCode), to test that the IPA file will work for other testers. That may mean buying an iPod touch, even the very oldest one will do (if you are targeting 3.x users).
I'd suggest you to right click your package, find a file embedded provisioning profile and open it with TextEdit. See that the name of the profile you've signed your application is indeed of that of ad-hoc.
After that be sure you sent this file (embedded provisioning profile) along with your ad-hoc build to your testers, because they have to install it on their devices, it's not being done automatically and w/o that profile your ad-hoc build will not sync to the device.
After some back and forth with DTS I managed to fix this issue.
The problem was that I was compiling for armv7 only which caused the installation to fail on armv6 machines.
Another interesting bit, the default universal project template and iphone projects converted to universal will compile for both architectures by default, this didn't happen for me bacause my project was initially an iPad only project which I converted manually (since there are no automatic tools for this) to be iPhone/iPad universal, this is the probable reason for this setting being incorrect in my project.