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

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.

Related

ERROR ITMS-90259: "Bad Bundle Executable. You must include a valid CFBundleExecutable key in your bundle's information property list file

I'm working on a multi-platform iOS and Mac app. When I try and Archive and Distribute to the App Store I run into this issue:
ERROR ITMS-90259: "Bad Bundle Executable. You must include a valid CFBundleExecutable key in your bundle's information property list file."
Verified that the Info.plist for the Mac target has a CFBundleExecutable
Tried Xcode 12 & 13
Tried using App Transporter
Used Xcode 13 RC and let that auto-generate the Info.plist
I've tried everything I could find online - there's not much - and I can't get the upload to succeed.
However, I was able to replicate the issue with an entirely empty project. No dependencies, no code, nothing. The project archives successfully, but the upload fails.
Any help would be appreciated. I've spent two days on this already.
An example project that fails: https://drive.google.com/file/d/1qUN5lHEWNyNHQV54fYPXMeRsuO-cpHqW/view?usp=sharing
We had two issues causing this, making it fail when uploading a Mac build to iTunes. The first issue, we had included a package (from Steam), that had its own plist and post build script.
com.rlabrecque.steamworks.net/Editor/RedistCopy.cs - build script
com.rlabrecque.steamworks.net/Plugins/steam_api.bundle.meta - folder with plugin and plist
We renamed the post build script and removed the plugin folder, not 100% sure if the renaming was needed.
Then, we had this in our own post build script that was causing issues, so we removed it too.
rootDict.SetString("CFBundleExecutable", "${EXECUTABLE_NAME}");
Then it worked! Also worth noting that we believe the CFBundleExecutable didnt actually end up matching the file name e.g. the file produced was a.pkg and the plist says:
<key>CFBundleExecutable</key>
<string>b</string>
But seems iTunes was ok with that. We use Unity and it seems in the pList the string was set to the "Product Name" (Edit > Project Settings > Player, at the top, "Product Name").
We also didnt need to use Transporter to upload.

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>

plist utility to convert info.plist in iphone app

I try to build an iPhone app with command line.
I have a problem on Info.plist file.
XCode converts a XML file MyApp-Info.plist to a binary file Info.plist, like this :
builtin-infoPlistUtility MyApp-Info.plist -genpkginfo <path>/MyApp.app/PkgInfo -expandbuildsettings -format binary -platform iphoneos -resourcerulesfile <path>/MyApp.app/ResourceRules.plist -o <path>/MyApp.app/Info.plist
Today, I compile Info.plist with XCode and then I can sign MyApp.app with codesign successfully.
I try to compile Info.plist with plutil tool, like this :
plutil -convert binary1 <path>/MyApp.app/Info.plist
It works, but then codesign failed with error :
object file format invalid or unsuitable
I think I need other options for plutil utility but I don't know which ones.
Any help please ?
Im quite sure that the Info.plist file does not need to be in binary format to work. Does work if you just leave it as standard XML file?
I have seen this error message when the CFBundleResourceSpecification key was missing, should probably have the value ResourceRules.plist. It also seams to happen if the CFBundleExecutable key is missing.
A good way to see which keys that are used in a resulting app bundle is to do this:
Create a new fresh iOS app in Xcode
Configure minimum version, platform, orientations etc.
Build the app
Expand the "Product" group in the project tree and choose "Show in finder" on the app
Choose "Show Package Contents" on the app bundle
Open the Info.plist file and inspect it
Use plutil if you want to convert to resulting binary plist to XML format.

How to use Xcode to open decrypted IPA contents

I have a decrypted IPA file. How do I use Xcode to open the contents of this file and make code modifications to it?
An IPA is just a zip file containing a "Payload" folder, which in turn contains the app bundle. As such there is no code in an IPA - just the compiled executable. You can unzip it and look in the "Payload" folder, but all you'll see is executable code. You could possibly disassemble the code (don't ask me how - I've never tried such a thing), but if you need to do that I wonder why you don't have access to the source in the first place...
You can't get the source from an IPA file. It's an executable. See Stack Overflow question
Is it possible to reverse-engineer my iPhone application?.
Xcode compiles apps from Objective C to machine code, then they are packaged with all the other resources (images, nibs) into an IPA file. So you can't get it back to source code, only machine code.