iTunes Connect Reports "Invalid Binary" for Mac App - objective-c

I am trying to submit my first application to the Mac App Store. I have setup the signing certificates on my computer, as well as setting up the application in iTunes connect. Xcode allows me to produce an archive of my app, and even export a signed pkg file. Both Application Loader and Xcode say that my binary passes "validation", but shortly after uploading my app to iTunes connect it is reported to have an "Invalid Binary." I read on Apple's iTunes Approval Process page some reasons why this might happen:
Appears when a binary is received through Application Loader, has been processed, but your binary is invalid. Examples of an invalid binary are: your binary icon does not meet our requirements, you have placed the payload directory at the wrong level in the .app wrapper, you attempted to use a non-increasing CFBundleVersion, etc.
Unfortunately I am not receiving an email when this error occurs, and nothing is telling me what the problem is. I am kind of hoping that Xcode would tell me if I signed my binary wrong in the "Validate" stage, but I may be wrong.
My question here is: why might iTunes connect be reporting an "Invalid Binary" and how on earth can I fix it?
EDIT: I have taken some screenshots of my project's configuration settings, and of iTunes connect:
iTunes connect app page
Application in the Archive list
Entitlements plist
Code signing settings
Info.plist
Build settings (architectures, etc).

You most likely are trying to submit a build that has the same version number as an earlier build. All builds that you upload to iTunes connect must have different version numbers. For example: Joe submits his first build of his app to iTunes connect as version 1.0, next time he submits he must change the version to 1.1 or any other higher value.

Related

Download .ipa build via App Store Connect API

Due to some unique quality and regulatory requirements in our organisation, we need to be able to download a .ipa build from App Store Connect, in order to be able to compare it against a locally built binary. I appreciate this is an unusual requirement, but it is non-negotiable.
Clearly there is no way to do this via the App Store Connect web interface, so I've been looking at the App Store Connect API. However it is ambiguous from the documentation, whether it is possible to use this to download an .ipa build.
Does anyone know if this is possible, and how one might go about doing it if so please?
Apple does not provide any way of retrieving an upload app/IPA. It's neither possible through App Store Connect nor the App Store Connect API.
You can only check entitlements and additional build information in the App Store Connect interface. For that go to App Store Connect > My Apps > Activity > All Builds > Click on the build
(Fastlane does also not provide any way, because Apple does not expose the data. It uses the "web API", i.e. has access to more information than the "standard" App Store Connect API)
We can download IPA file with the help of Apple Configurator. Follow below steps to download IPA file.
Download Apple Configurator 2 app on your MAC.
Connect your iPhone with MAC and Apple ID should be same in apple Configurator and iPhone.
New window will display with app count badge in All Devices Tab.
Right click on your connected device in Apple Configurator and select Add and then Apps.
Process will complete and Popup will show with options, no need to click any option and go to this path
~/Library/Group Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps/
Save IPA file in your directory
-Now stop Apple Configurator
EDIT: I know this question is aimed at Downloading Appstore/Testflight builds, specifically, but wanted to provide this answer for others who find your question while looking for it from anywhere.
You can download iOS .ipa from Firebase distribution, as well as for Android .apks. But you do need to have the right permissions.
I just did it 5 minutes ago. See ☝️?
Go into App Distribution > find your app scheme/variant > expand build number > see if you have a Download button. If you don't, your company needs to bump your permissions up a bit higher.
Keep in mind that firebase apps can experience limitations when interacting with Apple SDK features, though, like SIWA. You'd need to use Testflight to test things like that if they don't work for you (we have decent devs and never could get it working on Firebase builds).
If the file gets deleted before you can copy it, you can use this command:
watch -n 0.1 find "~/Library/Group\ Containers/K36BKF7T3D.group.com.apple.configurator" -iname "*.ipa" -exec 'cp -r {} ~/Downloads \;'
When it's downloaded it will copy it to the Downloads folder. You're welcome.
Part of the credits to my colleague Daniël.

How to remove code signing in Xcode?

I've created an iOS7 project in Xcode 5. It's a very simple app. I zipped it and sent it to another developer. When they open it, they get these messages:
No matching code signing identity found
No code signing identities (i.e.certificate and private key pairs)
matching "iPhone Developer" were found. Xcode can resolve this issue
by downloading a new provisioning profile from the Member Center.
How do they get around this? The app isn't going to be submitted to the app store.
Is this happening because they have not linked Xcode to their online developer account? Isn't an online developer account free?
The other developer can ignore that message if the intention is to run the app on the Simulator. But you must use code signing in order to run an app from Xcode on a device, even for testing purposes, even if the app is never going to be submitted to the App Store. And that costs $99/year. End of story.
You could turn your account into a Company account and put this developer on your company; that way the developer is covered under your $99.
Or, if you just want to send the app to someone for testing and you don't need them to run the app directly from Xcode on a device, you can create an Ad Hoc build targeted to their device.
And of course the developer can look at your code, test on the simulator, and run your previously built Ad Hoc build on the device - but not run from Xcode on the device, i.e. the developer can not build for a device without someone paying that $99/year fee.

App Wireless Distribution not working in iOS7. Internet Connection needed?

In iOS6 I used to install some of my apps over an adhoc network without internet sharing. So the iPad had no internet connection. Therefore I use a typical html and plist file. Everything was alright.
Now, in iOS7 the installation is not working anymore. It is just stuck in "Waiting" and nothing more happens. (Note: It is still working on my iOS6 iPad)
First I thought something might be wrong with my plist, but then I copied the files to my IIS Server and installed it from there. Here I had a internet connection on my iPad and everything worked out.
Is it possible that the wireless distribution now needs an internet connection in iOS7 e.g. to check the ipa in the app store or something like that? Because this is the only difference I can see.
The app is signed with a valid distribution profile.
Thanks for your help.
It turned out the installation of apps over the air in iOS 7 really needs an internet connection now. The iPad tries to contact at least the following URLs before installing the app.
ax.init.itunes.apple.com: The device obtains the current file-size limit for downloading apps over the cellular network.
ocsp.apple.com: The device contacts this site to check the status of the distribution certificate used to sign the provisioning profile.
It seems in iOS6 it was ok if those URLs were not reachable and now in iOS 7 they have to be reachable.
Well i just had the same problem and I figured it out. At least on my xcode this is what happened. Turns out the application target release code siging identities auto set to developer and not their current state, from xcode 4.x, which is distribution. So when I went to distribute my application I kept getting the same error you had. So Click on your project name in your project explorer then click on the application target, not the project, and make sure the code signing identity is not set to developer for your releases. I have no idea why the code signing identities were automatically set to the developer profile, maybe there was some sort of bug when updating from xcdoe 4.x to xcode 5 that caused this. But now other devices are able to install the program. Hope this helps.

Provisioning Profiles, certificates and such

I'm trying to understand the whole provisioning-proccess, but I just don't get it..
I have tried to read up, but it's too weird and difficult for me to understand, especially when English is neither my primary or secondary language..
I have been developing for a while, and I remember stressing alot when setting up my iphone for development the first time. When I go into Settings->General on my phone I have 17 profiles, but at least I got it working in the end.
Now, I'm porting my app to iPad, and I'm trying to add my iPad to the table.
This is what I did:
I went to developer.apple.com, added my udid in devices, I then went to provisioning on the same webpage, and saw three profiles, one uneditable(controlled by xcode), one connected to my app's AppID, and one connected to myself as an AppID.
I added my new iPad-device to all three of them to be sure, and downloaded them again.
I dragged the .mobileprovisions to iTunes and to Xcode, and I went into organizer and clicked Refresh to update them. I clicked Use for development on my iPad, and it says it contains those profiles. They're also in Settings->General on my iPad.
In my XCode project, I go under Targets->Build Settings->Code Signing, and set one of my new profiles to Debug, and one of the other to Any iOS Sdk inside it. I've tried multiple combinations. I also went to Project->Build Settings->Code Signing and did the same thing.
When I run my app on my device, it pops up two of the same error message saying A valid provisioning profile for this executable was not found.
When I now connect my iPhone, which has been working perfectly fine all along, the exact same thing happens. Two of the same error message.
The question:
Which profiles goes where? What is the difference between the profile containing myself as an AppID and the one containing my actual app's ID as AppID? What is the difference between Target->Build Settings and Project->Build Settings when it comes to Code Signing?
Also, we spent a lot of time making push work, and out app is on AppStore rigth now, so I don't want to start deleting profiles and ID's, cause I think I read somewhere that that could make the notification stop working.
Oh, and I downloaded a new certificate as well at some point, containing the new profiles, and it ended up in keychain named along with 1000 others..
Help :( ?
Sorry for long and extremely boring/noobish question.
I think that your code doesn't build because of a certificate issue - like you said at the end of your question - you "downloaded a new certificate at some point containing the profiles..." You need to understand that a certificate does not 'contain' profiles, but profiles are created and signed using a specific certificate. Check that you have the private key of this certificate - if the signing request was not issued by you, it will require someone else exporting this certificate for you from his own keychain. Keep in mind that downloading the certificate available in your developer account will not suffice.
As for everything else:
Which profiles goes where?
Make sure you're creating relevant profiles with correct bundle IDs for your apps. Distribution profiles should include AdHoc and AppStore profiles, while Development profiles are, well, for development :)
What is the difference between the profile containing myself as an AppID and the one containing my actual app's ID as AppID?
Not sure what you mean here. Myself as an AppID? Each profile is linked to a specific App ID that has a bundle ID - it can be used to compile any app that has this bundle or any sub-domain of it in the info.plist of the project.
What is the difference between Target->Build Settings and Project->Build Settings when it comes to Code Signing?
You can think of your Project->Build Settings as the global settings and the Target->Build Settings as the target-specific settings. If XCode can't figure out which profile to use from the target settings, it will go and fetch it from the project settings.
The problem was that after we had released our app to the AppStore, we forgot to put the "Edit Scheme->Run" back to Debug from Release. This had no effect on my iPhone because I have added it to the release-provisioning-test thing.

Trouble generating MASReceipt during development

I am working on developing a Mac application that has an in app purchase. I have done this before on iOS, but I cannot get it to work with the Mac app. After doing some research it looks like I will have to get and validate a receipt from the Mac App Store before this will work.
I believe that I have followed the steps to do this correctly,
1.) Build the app in Xcode.
2.) Launch the app through finder
3.) When prompted sign in with a TestUser account created in iTunesConnect
4.) The app closes with the error message
“AppName” is damaged and can’t be opened. Delete “AppName” and download it again from the App Store.
When I open up the bundle though I do not see the _MASReceipt/receipt folder and file - and I am still getting invalid product identifiers from StoreKit.
These steps seems to work for me the last time this happened:
Log out from Mac App Store.
Force quit storeagent and softwareupdated processes.
Try double-clicking the app to start it again.