Emit SwiftSupport directory for Ad Hoc builds - app-store

Is there a way to generate the SwiftSupport directory in Ad-hoc builds, i.e. without method=app-store in exportOptions.plist?
We build developer-signed .ipas for internal testing, then resign them with a distribution certificate before uploading to App Store Connect. But the ad-hoc builds do not contain the SwiftSupport directory, causing Apple to reject the package.
So, setting method to app-store produces SwiftSupport, but requires a distribution certificate, which the CI builder doesn't have. Is there any other way to instruct xcodebuild to generate this directory?

The SwiftSupport directory is inside the .xcarchive directory. Assuming your ipa and xcarchive are in the build/Applications directory, you can add the missing SwiftSupport directory to the ipa like so:
pushd build/Applications/myapp.xcarchive
zip -r ../myapp.ipa SwiftSupport
popd
This adds SwiftSupport at the root of the ipa archive. If you try to run something like zip -r myapp.ipa myapp.xcarchive/SwiftSupport, you'll get an extra myapp.xcarchive subdirectory.

Related

Why does my IPA file look like this when uploading/publishing to App Store?

I'm getting this error: 'This bundle is invalid. The IPA format requires a top-level directory named Payload, containing only a .app bundle and optional plugins in a Plugins directory.'
It should contain a .app bundle, and I'm wondering why it doesn't look like that.
IPA file
Any inputs would be helpful :)
Set mach-o type in build settings to 'executable'. Mine was previously set to static library.

Is there a way to view your app's .entitlements file from your app's .ipa archive?

I think there's an issue with my app's .entitlements file when a .ipa is created and so I want to check the Bundle ID of the entitlements file. There's a fairly complicated build script I am using to change some stuff in there before building so I want to see what the final product is. I know that there used to be an Entitlements.plist that I could get off of the ipa but it doesn't seem to be there any longer. Is there any way to access the .entitlements file now?
For those getting here via Google, the Information Apple provides at https://developer.apple.com/library/ios/qa/qa1798/_index.html is a lot more recent.
Specifially, after unzipping the IPA:
Display the entitlements in the app by running:
codesign -d --entitlements :- "Payload/YourApp.app"
and display the provisioning profile by running:
security -D -i "Payload/YourApp.app/embedded.mobileprovision"
Sure, unzip the .ipa file which will create a Payload directory. Inside of the Payload directory is the application package. Right-click the app package in Finder to "Show Package Contents".
Look for the embedded.mobileprovision file which you can open with a text editor or plist editor. Look for the <key>Entitlements</key>

Upload iOS build online

I am uploading ios build on testflight till now. But I am getting the following error on uploading any build (I also tried uploading the previous build again which I already uploaded on it).
Invalid IPA: Couldn't find executable specified in Info.plist - check the value of your CFBundleExecutable key.
I need to upload the build. Can someone suggest me a site other than testflight where I may upload the ios build or ipa file?
The other site you can use is http://diawi.com, i use it on my project now, very helpfull.
We had a problem with CFBundleExecutable ${EXECUTABLE_NAME}. Our iOS app was for example called OurAppName.
Ran fine in Simulator but when archived and deployed via organizer said CFBundleExecutable was not an executable file.
We checked the plist and the value for CFBundleExecutable was 'ourappname'. we unzipped the ipa > app folder (see how below) and there was a fie called ourappname but it was smaller than expected and not a exe (USE:ls -l should have x at end of -rwxr-xr-x ).
Bug was caused by a text file called 'ourappname' and when archive was built it took that as the exe and not OurAppName. Answer was to rename and or delete the file with same name as our exe. Do full clean build. and recheck final ipa.
To see contents of OurAppName.ipa :
Rename to OurAppName_ipa.zip (ignore warnings):
DOUBLE CLICK on OurAppName_ipa.zip to open (creates Payload folder containing OurAppName.app):
rename OurAppName.app to OurAppName_app (ignore warnings will change app bundle to folder).
Open OurAppName_app folder look for ...info.plist for app.
Check CFBundleExecutable is pointing to OurAppName.
Find OurAppName in folder do ls -l make sure it executable (USE:ls -l should have x at end of -rwxr-xr-x).
TIP FOR TEST FLIGHT:
If testflight download fails after 80% with UNABLE TO DOWNLOAD then drag the archive you built to a iOS device using Organizer.
Click on Device > applications and + at the bottom (i think dragging the ipa to the device in the organizer installs it as well).
in your info.plist file open as source code form and check CFBundleExecutable key is there or not and make sure it is written as
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>

Is there a way to re-provision an iPhone IPA file without re-compiling or using XCode?

We've created an iPhone application and provisioned the application for deployment. In XCode we've used the build & archive tool to create an IPA file that can be used for installation. When new devices are added to the profile we would like to re-provision the IPA without recompiling or re-exporting the app from XCode.
Is there any way to do this?
If you look at the detail tabs of the XCode Build Results window after your Ad Hoc build, you will notice that the last few steps include running the ProcessProductPackaging and CodeSign utilities.
If you copy those command lines (and the intervening and following steps, if any), you could manually run these commands (or from a shell script), substituting the newer mobileprovision file in the appropriate place, to create a reprovisioned ipa file without a recompile.

Create .ipa for iPhone

I developed one application for iPhone. After I build I got .app file in build folder.
My application name is Myapp, then i got Myapp.app file in the build folder.
My problem is i want to create the .ipa file. how is that.. it is for to install
jailbraked iPhone..
Create a folder named Payload.
Copy Myapp.app (from products of your project) into the Payload directory.
Right click and Compress the Payload directory.
Rename the zip file to Myapp.ipa.
** Update ** This answer is very old. Use Xcode to build .ipa archives now. (Product > Archive)
Run Script
/bin/sh
mkdir $CONFIGURATION_BUILD_DIR/Payload
cp -R $CONFIGURATION_BUILD_DIR/$PRODUCT_NAME.app $CONFIGURATION_BUILD_DIR/Payload
cp $CONFIGURATION_BUILD_DIR/$PRODUCT_NAME.app/iTunesArtwork $CONFIGURATION_BUILD_DIR
cd $CONFIGURATION_BUILD_DIR
/usr/bin/zip -r $PRODUCT_NAME.ipa Payload iTunesArtwork
rm -rf Payload iTunesArtwork
exit 0
With Xcode 4, there is now a way more easy way:
In the menu bar, go to Product > Archive.
The organizer will then open in the Archives tab, and you will be able to save an IPA using the Share… button.
If the Archive menu item is disabled, make sure you have the scheme set to iOS device and not the iPhone Simulator. You don't have to have a device plugged in, though.
I also wrote a script to do this from the command line: xcodearchive. It works similar to xcodebuild, but generates an IPA.
Signing Part:
This part is required for non-jailbroken phone and rest of the steps are same
Open Terminal and enter the following commands
codesign -f -s "Code signing certificate name" appNamewithextension
example
codesign -f -s "iPhone Developer: Durai Amuthan" sample.app
Verify it is signed using the following command
codesign -verify AbsolutePath_with_app_name
ipa creation Part:
Way 1:
1.Create a folder named Payload and copy the .app into it
2.compress it and you'll get Payload.zip
3.Now Change the extension from zip to ipa that's it
mkdir Payload
cp -R MyAppName.app Payload/
zip -r -s 64 Payload.zip Payload/
mv Payload.zip MyAppName.ipa
Way 2:
Drag and drop the .app in iTunes that'll create the iPa for you
Installation part:
If you had Tried the Way 1 in previous step then Drag and drop the .ipa in iTunes
Choose the device in iTunes and click install and apply the sync that's it
Follow the following steps
Upload your app file as a zip on www.diawi.com
Open the diawi url in your web browser.
You will find download application option there. Download the file and it will be downloaded as an IPA.
Also, if you want to include the logo file, add the icon to the directory and name it "iTunesArtwork". compress that along with the Payload directory that has the .app file in it.