How to solve: Xcode Archive upload failed with error 22421 - ios

I tried everything but I cannot upload a build to iTunes anymore. It worked for over a year perfectly, but since I had to re-install macOS Sierra, I get this error and trying over and over again doesn't help.
I have the latest Xcode from the App Store and I can run the App on my developer phone, the app is actually already in the App Store, I can use the simulator, no build errors, but the moment I try to upload a new build I get the 22421 error without any detailed description.
Does anybody know how to solve this?

I found this solution (in Terminal) on the official developer forums:
cd ~
mv .itmstransporter/ .old_itmstransporter/
"/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/itms/bin/iTMSTransporter"

You can try following solutions:
Use Application Loader to upload your app, as Xcode organizer can't upload file (rejects IPA) sometimes, without genuine reason and it's frequently occurring issue, with Xcode Organizer, that apple could not resolve permanently.
Solution for error code: 22421
Apple app upload server is not working properly (not in
connection or lost connection during file upload). Just wait and try
again later (may be after a day).
Fluctuation in your network
connection, during file upload.
You may not have added privacy
statements in your info.plist file.
Cocoa Keys: Here, is list of keys that you should consider to add in your info.plist file, if you have used that service in your application.
Nowadays, you may also face, this error code: 90186 (with app loader)
Outdated application loader can be reason of this error. Use latest Xcode tool and use application loader from Xcode Tool.
Incorrect/invalid provisioning profile, associated with your build. Ensure, your have used correct provisioning profile (A provisioning
profile with Distribution/Production mode is require. A Development mode provisioning profile won't allow your to upload app on store.)
You can find latest Application Loader Tool from latest Xcode Tool: Xcode -> Open Developer Tool -> Application Loader

Related

Watchkit app showing error during installation - The WatchKit app has an invalid stub executable

I have an app that supports Watchkit. When I run the application onto the iPhone, it builds fine but displays an alert in Xcode "The WatchKit app has an invalid stub executable". I have used the bundle identifier properly and installed the provisioning profiles and certificates properly as well. Any clue on this, please?
Pls note that I am building this project in Xcode 10.3 as the included frameworks are still in Swift 4.2 and couldn't be upgraded to Swift 5.
This was a known issue in Xcode 10 beta where the proposed solution was to clean the build folder and run again. I imagine you've tried that of course, but I have to mention it.
Also ensure you have selected to "Trust this computer" on the Apple Watch. If you haven't done that, then with Xcode open;
a) Connect the iPhone that you have your watch paired to the computer via cable.
b) Restart Apple Watch
c) Accept Trust This Computer when prompted on Apple Watch.
This error is more related to ipa making process than any project settings..
Avoid using older xcodes just to make ipa from the archive created using latest xcode as sometimes we don't have permission to export build.
You can use xcodebuild command to create ipa from archive and resolve this error, but can't make it to appstore as xocdebuild also come with a bug that it doesn't create support directories for watchapp (WatchKitSupport) and swift (SwiftSupport). However with this ipa, application will get installed on Apple Watch without any errors.
Also you may find a valid command which would make valid ipa but other options also have the same issues. Eg xcrun
Solution to this is make this folder structure by yourself and create ipa.
Related links:
1- Binary Rejection - Invalid Watchkit Support
2- How to generate .ipa file from command line with watchkit app
3- Getting error in watch app installation

Unable to upload app to App Store connect

I am trying to upload my app to the App Store connect but I'm not able to.
I was testing my app using Xcode 12 and without realising it was beta software, I archived my app and uploaded it. Now when I click on submit for review it says Binary Invalid. Then, I realized that I wasn't supposed to upload it using Xcode beta. Now, when I try uploading it with Xcode 11.5, It isn't letting me sign the app as I get an error saying Profile doesn’t include the com.apple.application-identifier entitlement .
I have tried the following Methods and none seem to work.
Close Xcode and Delete all provisional Files from ~/Library/ApplicationSupport/MobileProvisions/
2.Change the Bundle ID and also tried repeating (1.)
Create new certificates and profiles from the developer website(Both original and new bundle IDs)
Delete Xcode and reinstall it.
But in the end it only uploads it with Xcode 12 beta. (And throws an error saying Binary Invalid)
Please help me rectify this issue.
I struggled with this problem for two days, simple fix is to;
Build with 11.5
Archive / Upload with 12 beta
Here is the answer. Create your archive. In the organizer, select your archive. Choose distribute app. Then instead of upload, choose export. Export the archive to a folder on your hard drive. Now download transporter from the App Store. Transporter replaced "Application Loader" or whatever it used to be called in the developer tools menu of Xcode.
Now sign into Transporter with your dev account and upload the .ipa found in your exported archive folder using Transporter.
It will work under Big Sur!

iOS - Error: This action could not be completed. Try Again (-22421)

I am trying to upload an iOS App to the App Store, using Xcode >> Organizer, but I got the issue This Action could not be completed. Try Again (-22421) as in the below image.
I tried to re-upload app many times but same error occurred
Here is snaps for an issue I'm getting :
What to do next? How can I upload my app successfully on store?
Tried using Application Loader app and now getting another error
Error ITMS-90168: "The binary you uploaded was invalid.
Use Application Loader to upload your app, as Xcode organizer can't upload file (rejects IPA) sometimes, without genuine reason and it's frequently occurring issue, with Xcode Organizer, that apple could not resolve permanently.
There are few other reasons also for such kind of error, like
Apple app upload server is not working properly (not in
connection or lost connection during file upload). Just wait and try
again later (may be after a day).
Fluctuation in your network
connection, during file upload.
You may not have added privacy
statements in your info.plist file.
Cocoa Keys: Here, is list of keys that you should consider to add in your info.plist file, if you have used that service in your application.
Solution for error code: 90186
Outdated application loader can be reason of this error. Use latest Xcode tool and use application loader from Xcode Tool.
Incorrect/invalid provisioning profile, associated with your build. Ensure, your have used correct provisioning profile (A provisioning
profile with Distribution/Production mode is require. A Development mode provisioning profile won't allow your to upload app on store.)
You can find latest Application Loader Tool from latest Xcode Tool: Xcode (Menu) ► Open Developer Tool ► Application Loader
This works fine with application loader. You will have to create ur ipa from the Xcode organizer and use application loader.
I am facing this issue for the last week. finally uploaded using application loader.

This action could not be completed. Try Again (-22421) (Xcode)

I have tried to upload my app to App Store (iTunes Connect) to test my app in TestFlight, but always appears the same error message. I don´t know what I´m doing wrong. It´s the third day I´m trying to upload my app.
Also read that this is a problem from Apple's servers, but every day is the same problem.
Please help me with this problem.
I have done it with Application Loader. First export the .ipa file, and then proccesed in Application Loader to visualize in iTunes Connect. Never works with Xcode.
You can try following solutions:
Use Application Loader to upload your app, as Xcode organizer can't upload file (rejects IPA) sometimes, without genuine reason and it's frequently occurring issue, with Xcode Organizer, that apple could not resolve permanently.
Solution to error code: 22421
Apple app upload server is not working properly (not in
connection or lost connection during file upload). Just wait and try
again later (may be after a day).
Fluctuation in your network
connection, during file upload.
You may not have added privacy
statements in your info.plist file.
Cocoa Keys: Here, is list of keys that you should consider to add in your info.plist file, if you have used that service in your application.
Nowadays, you may also face, this error code: 90186 (with app loader)
Outdated application loader can be reason of this error. Use latest Xcode tool and use application loader from Xcode Tool.
Incorrect/invalid provisioning profile, associated with your build. Ensure, your have used correct provisioning profile (A provisioning
profile with Distribution/Production mode is require. A Development mode provisioning profile won't allow your to upload app on store.)
You can find latest Application Loader Tool from latest Xcode Tool: Xcode ▶ Open Developer Tool ▶ Application Loader
try this
cd ~
mv .itmstransporter/ .old_itmstransporter/
"/Applications/Xcode.app/Contents/Applications/ApplicationLoader.app/Contents/itms/bin/iTMSTransporter"

Xcode stuck at “Your application is being uploaded”

I am facing an issue while submitting my app from Xcode to the App Store. I have done everything regarding my project, and its running fine on my iPhone and iPad. But when I submit my project I am facing a huge problem.
First after archive I have done the validate. Now my archive file in Organizer is showing status pass validation as well. So I believe I am at the final step of submitting the app.
I have clicked on distribute and selected submit app to app store.
After login I have selected provisioning files as well.
I am stuck here. You can see in the screenshot below. And I have never seen any
progress bar where I can see the submission progress or something like that.
Only screen I can see is:
Edited:
It was near about 1.30 hours. And internet connection is working. My ipa file is only 3.5 MB.
And last when I tried Application loader to upload the same I received the following screen as well for a long time in Authenticating with the iTunes Store... ..
What should I do now?
As I felt a serious issue on this. I believe this answer might be helpful.
After trying for around 10 to 12 hours to fix this issue and as everything else regarding my project and coding was fine enough, it became a headache for me. But after getting some valuable comments from some of the expert users of stack-overflow and after doing some more search on the internet, I have found some quality answers.
This answer helped me the most:
application loader stuck at the stage of "Authenticating with the iTunes Store"
If you are going to upload it through Application Loader and it gets stuck on "Authentication with the iTunes Store..."
or
You are going to upload it through XCode and it stucks on “Your application is being uploaded”
Then just keep your head cool and check this first method:
Check if your firewall protection is off. If not then turn it off. It maybe blocking you to connect your computer with iTunes
Store.
Try a different internet connection. The purpose for trying a different internet connection is that your current internet connection maybe blocking a required port for connection to Apple servers.
If the above steps doesn't help you then follow this second method:
Xcode needs java runtime for uploading your apps to the App Store.
enter 'java -version' in the terminal, java version should be 1.6 .If not then download
latest compatible java only from apple download center:
http://support.apple.com/kb/DL1572?viewlocale=en_US
If this still doesn't help then follow this third method:
This method enables the application loader to use the HTTP port instead of HTTPS.
Go to
Application Loader java folder :
/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/java/lib
Open net.properties file using any text editor application like text mate or sublime text
Change this particular line : #https.proxyPort=443 proxy port to
https.proxyPort=80
Save the file. And that's it !! You can easily upload your binary file to App
store now.
If the above methods still doesn't help then follow this fourth method: Regenerate your certificate
Goto iOS developer portal (https://developer.apple.com/membercenter).
Revoke current certificate which is used by your App for signing.
Remove current "iOS distribution provision profile" from Developer
portal.
Regenerate the iOS distribution certificate and add them in developer portal.
Regenerate "iOS distribution provision profile" for app store
distribution and download to mac.
Install it.
Try again using xcode/application loader to upload the build.
There is definitely a problem if your app stuck on "application stuck process". I suggest you to go with Application loader rather than Xcode itself as Application loader shows the activity status. You can clearly know in which step you stuck.
The most frequent issue faced is to stuck on the "Authentication with the iTunes Store..." step.
There are possible two work around which I followed and finally submitted my app to app store. You can try both. For me both worked at least once.
Method One : This method plays with proxy port to use http connection over https
Go to Application Loader java folder : /Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/java/lib
Open net.properties file with "sublime text" or "text mate"
Change "#https.proxyPort=443" proxy port to "https.proxyPort=80"
Save the file and reopen Application Loader and Try again.
Method Two : Regenerate your certificate and iOS distribution provision profile and Try to upload
Goto https://developer.apple.com/membercenter
Delete previous certificate referenced by your App for signing.
Revoke your distribution certificate and download it to your mac. And install it by double clicking it.
Delete current "iOS distribution provision profile" from Developer portal.
Regenerate "iOS distribution provision profile" for app store distribution and download to mac.
Install it by double clicking it.
Try again using application loader to upload the build.
Edit: I again got this problem while uploading new build. Both of above methods were followed but was stucking in "Authentication..". Restarted the mac book and it worked. When you restart, the previous itunesconnect connection (which you might have opened in browser prior to submit your app) are reset which allows restarted mac to easily authenticate iTunes Connect. Yesterday (jan 26, 2014) the iTunesConnect authentication step proceeded within 2 mins. Hope this helps someone who is loosing patience while stuck on authentication step.
Edit 2: Before deleting distribution Certificate, try only regenerating "iOS Distribution Provision Profile". It worked for me else you can redo as above.
I Hope this helps. All the best.
I tried all the steps from Rajan's solution; none worked. However, this threads on apple dev forum (https://forums.developer.apple.com/thread/76803) gave me the solution in my case :
Try this, it fixed it for me. Open Terminal and run:
cd ~
mv .itmstransporter/ .old_itmstransporter/
"/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/itms/bin/iTMSTransporter"
iTMSTransporter will then update itself, then you can try uploading in XCode again.
For me, just logging out from ituneconnect website and developer.apple.com does work.And just using xcode to upload. No need to restart
I got this issue today. But finally I found it's caused by my wrong settings.
In 'Build settings' of the target, change settings "Code Signing Identity -> Release" to your production certificate, and "Provisioning Profile -> Release" to your distribution provisioning file.
Then archive and distribute it again.
You can try to cancel the upload and retry. If that does not work you may want to try the Application Loader from Apple. It essentially does the same thing, but does not resign the binary. You can download the application loader from itunes connect. See https://itunesconnect.apple.com/docs/UsingApplicationLoader.pdf (Getting Started, Page 9)
I had the same issue.
I cancelled and ran a validation check. It turned out I had written a URL Scheme incorrectly.
Xcode did not gave any errors when uploading and simply got stuck but validating gave the error.
So, try validation first. Hope this helps someone.
try this on terminal
cd ~
mv .itmstransporter/ .old_itmstransporter/
"/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/itms/bin/iTMSTransporter"
worked for me after hours of researching
This is Happened Due to the iTMSTransporter
Try this, it fixed it for me. Open Terminal and run:
Use these commands one by one on the terminal. Hope it will help you
cd ~
mv .itmstransporter/ .old_itmstransporter/
"/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/itms/bin/iTMSTransporter"
iTMSTransporter will then update itself, then you can try uploading in XCode again.
I met this issues many times, I tried all steps but it still not working (home network) and try other network work fine (company network).
I fixed this problem by update latest Java SE from 1.6 to 1.7 and it work like a charm
To be honest, this may not be an answer but it really worked for me.
I launched Application Loader and started submitting. While sumbitting was going on,
I launched Organiser and select Distribution over archiver in Xcode as well and started uploading concurrent.
They worked together and 2nd one completed the submission.
Just my experience.
For me the issue was that I've changed my Dev. Account at some point of time and Application Loader itself was not authorized anymore. You have to manually to go it (Xcode -> Open Developer Tools -> Application Loader) and fill in your account details
I had the same issue. I as able to fix it by:
Remove/delete all distribution certificates and provisioning profiles from my machine.
Revoke distribution certificates and delete distribution provisioning profiles from Member Centre at developer.apple.com
Create a new Distribution certificated by generating a new certificate signing request from keychain access
Create a new provisioning profile for app store distribution
Download newly created certificate and add it to keychain access
Download newly created provisioning profile and add it to xcode. OR sync from Xcode from account settings.
Try to upload again.
This is some silly issue that Apple needs to fix asap. I wasted 2 days from something as silly as this.
I had the same issue. Trying all these answers may work sometimes, but usually it takes much time and may not work at the end like in my case.
I figured out a solution which will probably work for all.
Create your .ipa file by: Product -> Arcive -> Disribute(Save for Enterprise or ...) -> Next and save .ipa at target
Xcode -> Open Developer Tool -> Application Loader -> Deliver your app -> Pick your .ipa file
Withing few minutes your app will submit to iTunes. Good luck
All i did was duplicate my Application Loader.app in /Applications and ran both Application loaders at the same time.
I had the same issue after updating Xcode5 to Xcode6. After hours of craziness, the one and only thing that helped me was to delete my account in Xcode preferences and add my account again.
Last week I had the same issue after update to Xcode7, this helped me again...
If you are running inside a virtual machine (e.g. VMWare or VirtualBox), try setting the network adapter mode from the default NAT to Bridged.
This worked for me:
Logout from iTunes portal in all the browsers.
Restart your Mac machine.
Open Application Loader
Click on your Apple Login in the Top Right corner of the Application Loader Window.
Clicking Next will succeed your authentication process.
Now, do your process as usual by clicking upon the "Deliver Your App" and following the procedure beyond that.
My problem was I forgot to change the Bundle Identifier in info settings for the target. Hope it help someone.
I had similar issue while uploading iOS apps through application loader.Then once after i opened iTunes parallel all of the sudden uploading apps was faster.Not sure if iTunes has any dependency with application loader.
None of the answers worked for me and my upload was hanging for days without any error. (my build was generated using Expo). Here's what I did to make this work:
In the apple's guideline, it says one way to upload the build is to use the Transporter.
Using the Transporter, it was able to detect and output the error.
It turns out the root cause for me was the XCode version was 9 but it has to be 10.
I hope this helps others who are struggling on this issue.

Resources