I have automation of submission of iOS apps to the AppStore. In Windows Machine the batch file executed:
plink.exe -batch -pw [PASSWORD] [LOGIN]@[IP_ADDRESS] /Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework/Versions/A/Support/altool --upload-app -f /Temp/upload.ipa --type ios -u [USERNAME] -p [PASSWORD]
PLink connected to remote MAC Machine and executed altool, which uploads the app to AppStore. The code was working before but after I updated both XCode (i.e. altool) and plink, it doesn't work anymore. The error output is the following:
2023-04-28 07:02:57.682 *** Error: /usr/bin/ditto, terminated with status: 1
2023-04-28 07:02:57.686 *** Error: Validation failed for '/Temp/upload.ipa'.
2023-04-28 07:02:57.686 *** Error: The package could not be unpacked because of the following error: Unable to extract archive. Please make sure /Temp/upload.ipa is a valid zip or ipa archive. Unable to validate your application. (-20008)
{
NSLocalizedDescription = "The package could not be unpacked because of the following error: Unable to extract archive. Please make sure /Temp/upload.ipa is a valid zip or ipa archive.";
NSLocalizedFailureReason = "Unable to validate your application.";
}
BUT, if I execute altool directly on MAC OS (altool with exactly the same parameters):
/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework/Versions/A/Support/altool --upload-app -f /Temp/upload.ipa --type ios -u [USERNAME] -p [PASSWORD]
Then the upload successed:
================
UPLOAD SUCCEEDED
Delivery UUID: *****
Transferred 54415023 bytes in 2.467 seconds (22.1MB/s)
================
No errors uploading '/Temp/upload.ipa'
I checked that it can access the file (if I put wrong file name, I get a different error). I try add sudo before altool - it doesn't make any difference. Obviously all passwords are correct, because if I put wrong password, it gives me another error.
I run out of ideas. Please help.
Why direct use of altool works, but it doesn't work remotely over plink?
OK, I feel stupid after found the solution, but decided to post it in case it may be helpful to anyone.
I used the Temp folder which I created on my Mac OS Desktop to temporarily save the IPA file. Even after I changed permission to read/write to anymore (to the folder and enclosed items), I still can't make it works. The solution is to use /private/tmp folder (alias is just /tmp, but alias is not visible remotely from Windows). /tmp folder has permission to write to anyone from the scratch, so you don't need to change anything. So, this was the issue with "The package could not be unpacked" message. I guess
altooltrying to unpack the IPA in place.Secondly, and this is more related to my tool which execute batch file on Windows - for some reason
altoolwrites ALL it's output toStandardErrornot toStandardOutput. This is quite weird, but all normal messages goes to Standard Error output, nothing comes from Standard Output. So, if you try to readStandardOutput- you will get nothing.