-1

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?

Mike Keskinov
  • 11,614
  • 6
  • 59
  • 87
  • I do not have a specific answer, but for a start, check: [Executing command using Plink does not work, but does in PuTTY](https://stackoverflow.com/q/46591648/850848). – Martin Prikryl Apr 28 '23 at 11:45
  • After looking into some related topic, I need to clarify that in this case it doesn't matter if I execute .bat file or just type the command on Windows machine in `cmd` - the error is the same. – Mike Keskinov Apr 28 '23 at 12:06
  • I do not see why should it matter. Have you seen a topic that says otherwise? – Martin Prikryl Apr 28 '23 at 12:12

1 Answers1

-1

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 altool trying to unpack the IPA in place.

Secondly, and this is more related to my tool which execute batch file on Windows - for some reason altool writes ALL it's output to StandardError not to StandardOutput. This is quite weird, but all normal messages goes to Standard Error output, nothing comes from Standard Output. So, if you try to read StandardOutput - you will get nothing.

Mike Keskinov
  • 11,614
  • 6
  • 59
  • 87