Ipa creation using any script(ipa creation from other ipa ) - ios

basically my project based on books(combination of pdf's and xml's). Due to some reasons we are maintaining more than ten provisioning profiles.when ever new device udid comes up we need to create another provisioning profile(as per the requirement). For each time building i need to put some provisioning and replacing books in my xcode, this is causing more time consuming. I seen many scripts but all those not full filling the scenario.
Questions:
1.Is it possible to develop another application (mac osx) to make ipa which is taking an input of provisioning file, my code(ios) and books then compile finally giving output as .ipa file for giving code?
2.is any other way to reduce time consuming for the ipa creation?
If any possible please give me some idea to make it true , your suggestions is also more important on this.Thanks in advance to every one.
new question for generating Ipa from other ipa file
I followed your approach,But can any one please let me know ,i created a ipa file and now i want to modify the content of ipa and also provisioning profile will it possible?

If you have an ipa created using older provisioning profile and the code hasn't changed between getting next provisioning profile then there is a way to do it.
You can write a script from following steps:
1) Change the .ipa that you already have to .zip and extract zip contents. This would reveal Payload folder that has YourApp.app folder
2) Right click on YourApp.app folder and show package contents
3) find embedded.mobileprovision and delete it. Drag your new .mobileprovision file into this location and rename it to say embedded.mobileprovision.
4) Find and delete any _CodeSignature or CodeResources files/folders
5) From terminal delete .DS_Store files in Payload and YourApp.app folder
6) Use Codesign utility in /usr/bin/codesign to codesign your .app. Here is command for it:
codesign -f -s "iPhone Distribution: Your company Name" PathToYourApp
In your keychain utility find the certificate name that is used to create the distribution profile and match it to first argument in codesign -f -s
7) finally zip the payload to form an ipa
zip -r YourApp.ipa Payload

Related

Is that safe to share .xcarchive?

I`m somehow amateur in Xcode and this matter is so important for me.
My Friend use his developer id to publish my app and he ask me to give him .xcarchive instead *.ipa file
As I read in stackoverflow topics .xcarchive have the same content of ipa and there is no concern about lose and steal source code.
But when I check my xcarchive and use show content option I see most of project files like images and sources in application folder , also some of my code are in *.nib files
Is that normal ? and if I extract ipa if I get the same result ?
Is there any security or tips in Xcode that better to active before archive project ?
It is normal. In order to publish your app, your friend really needs the xcarchive, because they need to export an IPA file with the appropriate provisioning profile and signed with their code signing identity. Although it's possible to replace the provisioning profile in an IPA file and re-sign it again, it's a daunting task you don't want any of your friends to do. If you trust your friend with publishing your app, you should trust them and share the xcarchive.
When you compare the contents of xcarchive and IPA files, you can see xcarchive contains a dSYMs folder with dSYM files used to desymbolicate your crash logs -- the developer needs that to know in what file and at what line number the application crashed.

Invalid Signature (Invalid Binary) on iTunes Connect

I know is a duplicate question, but on all other questions i cant find a solution, so i retry to post question with more details.
I archive my app on xcode5 for iOS7 with Release Scheme and correct Provisioning Distribution
that's the screen:
This is on Project
And This is on Target
I try to do many different asset, i'am sure to my Building Archive is on Release but the answer of iTunesConnect is every time the same:
Dear developer,
We have discovered one or more issues with your recent delivery for
"MyApp". To process your delivery, the following issues must
be corrected:
Invalid Signature - Make sure you have signed your application with a
distribution certificate, not an ad hoc certificate or a development
certificate. Verify that the code signing settings in Xcode are
correct at the target level (which override any values at the project
level). Additionally, make sure the bundle you are uploading was built
using a Release target in Xcode, not a Simulator target. If you are
certain your code signing settings are correct, choose "Clean All" in
Xcode, delete the "build" directory in the Finder, and rebuild your
release target.
Once these issues have been corrected, go to the Version Details page
and click "Ready to Upload Binary." Continue through the submission
process until the app status is "Waiting for Upload." You can then
deliver the corrected binary.
Regards,
The App Store team
And Invalid Binary
I become to crazy to understand how to sole this issue, any body have idea to do this?
Thanks.
****Test Response****
Athority Screen
is correct
In Xcode, at the target level do the following:
First choose the provisioning profile for the Release configuration. (For Any SDK)
The provisioning profile must match the app's Bundle ID (As you can see in the General tab).
In the code signing identity, tap on the sub-menu for Any iOS SDK and make sure you choose Automatic. If you can't see below.
Clean All and Archive.
Choosing CodeSign identity:
In step 2, if you can't choose Automatic, then it means you might not have a match between the AppID and the app's Bundle ID.
The AppID is pointed by the provisioning profile you chose.
If this is the case, then login in the developer portal and make sure that the provisioning profile you used points to the correct AppID.
To verify the the .ipa or .app before you submit try these commands.
Then look at the printout, and see if all looks right. Also verify the expiration date.
$cd <where the app is>
$unzip *.ipa
$cd Payload
$codesign -d --entitlement - *.app
$codesign --verify -dvvv *.app
$security cms -D -i *.app/embedded.mobileprovision
In Apple developer support, I've seen two additional common causes of the Invalid Signature binary rejection reason,
executable files containing special characters (i.e. non-numeric, and non-alpha). To resolve this issue, change the Xcode target’s Product Name build setting from “${TARGET_NAME} to a string containing only alpha/numeric characters. Let me know if this was the cause of the issue (and the problematic characters) because I file bug reports to fix each instance I find here.
Apple Double Files ("double files") that result from copying the Xcode project uncompressed to/from a non HFS+ formatted hard drive. To check if this caused your rejection: 
A. Run the app diagnostic here: How do I check if my application's signature has been corrupted?
B. Then check the command line output with: List of Signature Verification Failure Root Causes. Double files are diagnosed with a message like:  
resource missing: my.app/._.*
C. From the docs:
The file prefixed with "._" is considered an AppleDouble file and it
can result from copying the uncompressed Xcode project folder onto a
non-HFS+ formatted disk. The AppleDouble files must be removed using
the 'dot_clean' command. The Xcode project folder is the argument to
dot_clean as illustrated below. Note: You can drag your Xcode project
folder from Finder into the Terminal window to automatically fill its
path into the command.
dot_clean /path/to/My_Xcode_Project
(If Terminal can't find the dot_clean utility, download the optional Command Line Tools through Xcode > Preferences > Downloads)
D. After running dot_clean on your Xcode project, create a new app archive (via Xcode > Product > Archive), reattempt submission.
To prevent double files be sure to compress the Xcode project folder to .zip using Finder before transferring it to/from a non HFS+ formatted hard drive. 
Now it must be include following architecture.
armv7 armv7s arm64 i386 x86_64
Try this.

Add file to already packaged .ipa

As the title says I'm looking for ways to add an additional file to an already packaged .ipa.
We need this for an in-house app to add a saml certificate to the ipa so that the user doesn't need username/password any more to log in.
Adding the file on the server when the download request comes from the user isn't the issue, the problem is, that the ipa won't install on the device any more.
I've read in the Apple documentation that you can omit certain files from being signed, so I extracted the ipa using "The Unarchiver" on a Mac, and added the following to the ResourceRules.plist;
saml.txt
omit
weight
200
I also tried omitting all txt files, as described here: http://lists.apple.com/archives/xcode-users/2011/Apr/msg00277.html
(^Resources/.*.txt
omit YES
weight 200")
First off, I don't really know what rule the weight property plays. I wasn't able to find any documentation about this.
Anyways, I saved the file, compressed the Payload again using the tools OS X provides and renamed it to the required ipa filename.
Unfortunately, the ipa won't install on a device. It downloads fine, but installation fails.
What am I doing wrong here and how to I overcome this issue?
Since it probably matters, the ipa is generated with Flash Builder, so I don't have all the build settings available that XCode has.
If someone's got a hint, please let me know!
Cheers!
Finally found a proper solution.
This is a step by step guide to add or alter files to the already packaged ipa;
Rename the .ipa package to .zip
Extract the .zip package
Go into the Payload's app content's directory and change the ResourceRules.plist file to your needs. In our case, we needed to add another file to the list of excluded files.
File.txt
omit
weight
10000
Using Apple's codesign, re-sign the package with the new ResourceRules:
codesign -f -s "iPhone Distribution: cert name" --resource-rules "Payload/AppName.app/ResourceRules.plist" "Payload/AppName.app"
Zip the Payload again.
That's basically it. Now you can alter "File.txt" as long as you want without invalidating the ipa package.
.ipa file is a packaged "zip" files in other words. Which contains all of your application codes and all the .h & .m files. So it is basically a zip file of your complete xcode project.
Now once the file is zipped (.ipa) file its not possible to add any thing till the time the file has been extracted.
And no one in the world except Apple can do add files to a .ipa file.
Hope this will help you.

Change app Version with only IPA file provided (no xcode)

I have an app that was developed for my company. Unfortunately it needs to be resigned (i know how do this part) because the distribution cert has expired. The problem is we need to change the version number so it allows for an update on all iPads. Does anyone know how to do this using terminal (i have xcode installed but i dont have and of the files from the developers). Once again, i only have the IPA file for the app.
Thanks for any help.
Rename the .ipa to .zip, and unzip the archive.
Inside should be a folder called "payload", and inside that folder should be your application archive.
Right-click the application archive, and choose "show package contents."
Find the Info.plist file (either named "Info.plist" or "AppName_Info.plist"). Open that file with a text editor
Change the value of "CFBundleVersion" and "CFBundleShortVersionString" to your desired version number.
Re-zip the archive
Rename the .zip to .ipa
Re-sign the .ipa
In answer to Chris Emerson's comment above (sorry, I don't have enough reputation to add another comment so I'm adding an answer) it is still possible to do this! I have just done it for an IPA with latest updates to everything iOS 8.3, OX Mavericks. I was getting the same message "... could not be installed at this time" and it turned out to be an issue with the entitlements in the provisioning profile not matching the entitlements in the *.app.
You can check the entitlements in both like this: https://developer.apple.com/library/ios/technotes/tn2318/_index.html#//apple_ref/doc/uid/DTS40013777-CH1-TNTAG68, and I put an answer detailing how I fixed the entitlements of my IPA so that they matched here: Alter Minimum OS Version of IPA without XCode, iOS 8+.

Problems creating an ipa file

I want to create an ipa file but I get the following error message. Maybee someone knows what's going on here? Or just a hint where the error might be.
Sometimes it may happen that Xcode Archiver fails to generate ipa file. Then here is the another option.
Build the application.
After successful build go to "Products" folder in your project navigator.
Right click on it and go to "Show in Finder".
Copy the .app file.
Create a new folder at some other location lets say on Desktop with name "Payload".
Paste that .app file in Payload folder.
Zip the Payload folder.
Rename that zipped folder with .ipa
Thats it.
Reverse procedure is used to retrieve the app file from an ipa file.
Hope this answer helps.
Check to make sure you have changed your Code Signing Identity to a Distribution profile, rather than your Developer profile cert. You need to explicitly create a Distribution cert in the provisioning areas of the Apple Developer website.
Here are two links that are pretty helpful, first and second.

Resources