Search Unity

Path to the final IPA file

Discussion in 'Unity Build Automation' started by Wolar, Oct 2, 2019.

  1. Dunk86

    Dunk86

    Joined:
    May 10, 2015
    Posts:
    53
    For anyone attempting this today, try ${UNITY_PLAYER_PATH} in your post-build script.
    For iOS this points to the .ipa location
    For WebGL it points to the build folder
    For Android it points to the .apk or .abb
     
  2. frothypants

    frothypants

    Joined:
    Jul 23, 2016
    Posts:
    17
    Hey there, I'm trying to get up and running with this script. I've been building with a Macbook that I no longer have. Troubled area of the log below.

    When building with the macbook I always had to go into a the Unity project in xcode and set always embed frameworks to no. I need to figure out which framework is trying to get bundled in so I can disable it form the unity side since I can't do it in xcode using this method. Any ideas?

    Here's the unity version I'm using and some packages as well.
    Unity 2020.3.3f1
    URP
    2D Sprite
    2D SpriteShape
    TextMeshPro
    Easy Mobile Pro
    Easy Save
    Nice Vibrations

    Code (CSharp):
    1. 26072: [2021-04-11 20:39:48 UTC] <main> DBG-X:   parameter ErrorCode = 1102
    2. 26073: [2021-04-11 20:39:48 UTC] <main> DBG-X:   parameter ErrorMessage = ERROR ITMS-90206: "Invalid Bundle. The bundle at 'RUBY.app/Frameworks/UnityFramework.framework' contains disallowed file 'Frameworks'.
    3. 26074:  (1102)
    4. 26075: [2021-04-11 20:39:48 UTC] <main> ERROR: ERROR ITMS-90206: "Invalid Bundle. The bundle at 'RUBY.app/Frameworks/UnityFramework.framework' contains disallowed file 'Frameworks'."
    5. 26076: [2021-04-11 20:39:48 UTC] <main> DBG-X: The error code is: 1102
    6. 26077: [2021-04-11 20:39:48 UTC] <main>  INFO: Done performing authentication.
    7. 26078: [2021-04-11 20:39:48 UTC] <main>  INFO: JSON:{"msg":{"phase":"Upload","count":3,"description":"Operation failed","index":3},"messageType":"VerifyProgress"}
    8. 26079: [2021-04-11 20:39:48 UTC] <main> DBG-X: Returning 1
    9. 26080: 2021-04-11 20:39:49.154 altool[15427:75403]  Out:
    10. 26081: Package Summary:
    11. 26082:
    12. 26083: 1 package(s) were not uploaded because they had problems:
    13. 26084:         ERROR ITMS-90206: "Invalid Bundle. The bundle at 'RUBY.app/Frameworks/UnityFramework.framework' contains disallowed file 'Frameworks'."
    14. 26085: 2021-04-11 20:39:49.194 altool[15427:75379] *** Error: Error uploading '/BUILD_PATH/umok-games.umok-ruby.umok-ruby-ios-cloud-build/.build/last/umok-ruby-ios-cloud-build/build.ipa'.
    15. 26086: 2021-04-11 20:39:49.194 altool[15427:75379] *** Error: code -18000 (ERROR ITMS-90206: "Invalid Bundle. The bundle at 'RUBY.app/Frameworks/UnityFramework.framework' contains disallowed file 'Frameworks'.")
     
  3. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    Unity has PBXProject (https://docs.unity3d.com/2019.1/Documentation/ScriptReference/iOS.Xcode.PBXProject.html) which has lots of functions that can modify the xCode project. For example, you can remove frameworks from the project.

    You can use these functions in a post build step. I use something similar that I've posted below. It just sets the 'post export compliance' to true and adds some basic frameworks to the project. You should be able to modify it to suit what you want to do:

    Code (CSharp):
    1. #if UNITY_IOS
    2. using UnityEngine;
    3. using UnityEditor.Callbacks;
    4. using UnityEditor;
    5. using UnityEditor.iOS.Xcode;
    6. using System.IO;
    7.  
    8. public class ProvideExportCompliance
    9. {
    10.     [PostProcessBuild]
    11.     public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
    12.     {
    13.         // Performs any post build processes that we need done
    14.         // (iCloud/Export Compliance/AdMob)
    15.         if( buildTarget == BuildTarget.iOS )
    16.         {
    17.             // PList modifications
    18.             {
    19.                 // Get plist
    20.                 string plistPath = pathToBuiltProject + "/Info.plist";
    21.                 var plist = new PlistDocument();
    22.                 plist.ReadFromString(File.ReadAllText(plistPath));
    23.  
    24.                 // Get root
    25.                 var rootDict = plist.root;
    26.  
    27.                 // Add export compliance for TestFlight builds
    28.                 var buildKeyExportCompliance = "ITSAppUsesNonExemptEncryption";
    29.                 rootDict.SetString( buildKeyExportCompliance , "false" );
    30.              
    31.                 // Write to file
    32.                 File.WriteAllText( plistPath , plist.WriteToString() );
    33.             }
    34.          
    35.             // xCode workspace modifications
    36.             {
    37.                 // Get xCode Project
    38.                 string projectPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
    39.                 PBXProject project = new PBXProject();
    40.                 project.ReadFromFile( projectPath );
    41.                 string targetGuid = project.GetUnityMainTargetGuid();
    42.              
    43.                 // Add AdSupport(AdMob) & CloudKit(iCloud) framework
    44.                 project.AddFrameworkToProject( targetGuid , "iAd.framework" , false );
    45.                 project.AddFrameworkToProject( targetGuid , "CloudKit.framework" , false );
    46.                 project.AddFrameworkToProject( targetGuid , "CoreTelephony.framework" , false );
    47.                 project.AddFrameworkToProject( targetGuid , "AdSupport.framework" , false );
    48.                 project.AddFrameworkToProject( targetGuid , "AdServices.framework" , false );
    49.          
    50.                 // Update xCode project
    51.                 string projectString = project.WriteToString();
    52.              
    53.                  // Save the xCode project file
    54.                 File.WriteAllText( projectPath , projectString );
    55.             }
    56.         }
    57.     }
    58. }
    59. #endif
     
    masterton and frothypants like this.
  4. tarmo-jussila

    tarmo-jussila

    Joined:
    Jun 4, 2015
    Posts:
    42
    I'm having issues with the 2FA session, specifically this seems like a manual process that should be eliminated from any CI process. It seems using the new App Store Connect API with Fastlane would solve this issue.

    Has anyone had any luck with the Unity Cloud build and App Store Connect API? Is that supported by the Fastlane version the UCB uses?
     
  5. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    I've not had any issues uploading IPA builds from cloud build to TestFlight, is that what you're trying to do? Make sure you use an application specific password from your apple account, that way it won't require two factor authentication but it will still be secure as it has limited access. (https://support.apple.com/en-gb/HT204397)
     
  6. tarmo-jussila

    tarmo-jussila

    Joined:
    Jun 4, 2015
    Posts:
    42
    That's exactly my use case, uploading the IPA to TestFlight after the build has finished.

    I'm trying to use Fastlane for this, not had no luck so far. I've also generated the App-Specific Password, as you suggested, but something seems to stopping the "upload_to_testflight" command. Latest issue that was logged was related to 2FA, which I thought was not supposed to be an issue when using the app specific password...

    Which environment variables are you using?
     
  7. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
  8. tarmo-jussila

    tarmo-jussila

    Joined:
    Jun 4, 2015
    Posts:
    42
    No, I'm not using xcrun, I'm attempting to use Fastlane.

    Seems like I should look into the solution you provided, instead.

    EDIT: I was able to get the automation working with Fastlane. The important bit was that Fastlane works without 2FA requirement if BOTH apple_id and skip_waiting_for_build_processing are sent as parameters to upload_to_testflight action. This was mentioned in the Fastlane docs, but it's an easy oversight.
     
    Last edited: Aug 10, 2021
  9. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
  10. voody2506

    voody2506

    Joined:
    Jun 21, 2018
    Posts:
    17
    Hello, Do you find any solution to solve this problem?
     
  11. tarmo-jussila

    tarmo-jussila

    Joined:
    Jun 4, 2015
    Posts:
    42
    Looking for a solution for Google Play and Android as well.

    I was able to configure the pipeline to iOS/TestFlight using the "Custom Fastlane Configuration Path" in the Unity Cloud Build config Advanced Settings, but that setting is not available when building for Android targets.
     
  12. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    243
    I'm trying this for iOS. But encounter the following. For one thing, it seems that XCode Command line tools are not installed: xcrun: command not found That seems odd?

    Errors in the cloud build log:
    3849: Executing Post-Build Script at Assets/Editor/post-build-push-ipa-appstore.bash
    3850: /BUILD_PATH/MyOrg.MyProject.default-ios-development-appstore/Assets/Editor/post-build-push-ipa-appstore.bash: line 2: echo Uploading IPA to Appstore Connect...: command not found
    3851: /BUILD_PATH/MyOrg.MyProject.default-ios-development-appstore/Assets/Editor/post-build-push-ipa-appstore.bash: line 5: if xcrun: command not found
    3852: /BUILD_PATH/MyOrg.MyProject.default-ios-development-appstore/Assets/Editor/post-build-push-ipa-appstore.bash: line 5: then: command not found
    3853: /BUILD_PATH/MyOrg.MyProject.default-ios-development-appstore/Assets/Editor/post-build-push-ipa-appstore.bash: line 6: : command not found
    3854: /BUILD_PATH/jMyOrg.MyProject.default-ios-development-appstore/Assets/Editor/post-build-push-ipa-appstore.bash: line 7: syntax error near unexpected token `else'
    3855: /BUILD_PATH/MyOrg.MyProject.default-ios-development-appstore/Assets/Editor/post-build-push-ipa-appstore.bash: line 7: `else'
    3856: ! build of 'default-ios-development-appstore' failed. Post-Build script exited with status 2. Aborting.


    • I opted out of the Windows build machines
    • Script is located in the project
    • Added the path to the Post-Build Script settings: Assets/Editor/post-build-push-ipa-appstore.bash
    • Using an AppStore provisioning profile
    • I set an app specific password for my iTunesConnect/Apple account
    • Added the environment variables
    • Script:

    Code (CSharp):
    1. #!/bin/bash
    2. echo "Uploading IPA to Appstore Connect..."
    3. #Path is "/BUILD_PATH/<ORG_ID>.<PROJECT_ID>.<BUILD_TARGET_ID>/.build/last/<BUILD_TARGET_ID>/build.ipa"
    4. path="$WORKSPACE/.build/last/$TARGET_NAME/build.ipa"
    5. if xcrun altool --upload-app -f $path -u $ITUNES_USERNAME -p $ITUNES_PASSWORD ; then
    6.     echo "Upload IPA to Appstore Connect finished with success"
    7. else
    8.     echo "Upload IPA to Appstore Connect failed"
    9. fi
    Any tips anyone?
     
    hagenfilip likes this.
  13. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    There's a similar issue here (https://forum.unity.com/threads/bes...ploading-to-testflight-from-ios-build.863806/)

    Whereabouts is your shell script placed? Does it have a sh/bash extension? I have mine in assets/editor/post-build-push-ipa-appstore.bash

    I'd make sure that it's not got any spaces in the path in case that's causing any issues. Maybe try saving the shell script is utf-8 format too with unix line endings in case that's also an issue.
     
    Jelmer123 likes this.
  14. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    243
    I have the exact same path + filename as you. Judging by my log file, the script is found and it is attempted to be executed by cloud services.

    I now tried to change the line endings to UNIX by using dos2unix tool on MacOS. But I still get the exact same errors. I'm not so familiar with line endings and encodings. Could it be that Unity or Sourcetree/Github also convert the line endings back?

    I found this especially strange:
    3850: /BUILD_PATH/MyOrg.MyProject.default-ios-development-appstore/Assets/Editor/post-build-push-ipa-appstore.bash: line 2: echo Uploading IPA to Appstore Connect...: command not found

    I mean, echo itself is not supposed to turn up in the log? Seems like it doesn't understand anything so to say (wrong programming language?)
     
  15. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    Yeah, it sounds much more like a Unity issue than something you're doing. It's almost like it's not got the correct environment paths to find any of the standard unix tools (like echo etc...) I've got the same script and it's always been working fine so I think you should maybe open a ticket with Unity. Alternatively you could try setting up another config or doing a clean build in case it's something odd like that. Also, have you modified the script at all? The first line is not a comment so it's important you don't modify or delete it.

    p.s. Here's what my log looks like:
     

    Attached Files:

    • Log.png
      Log.png
      File size:
      8 KB
      Views:
      316
    Last edited: Oct 21, 2021
  16. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    243
    OK my colleague was using Ryder IDE instead of Visual Studio. In Ryder the problem became immediately clear: there were nbsp (non breaking spaces) in the script! Likely because I copied it from this forum.

    I do find it quite weird that visual studio doesn't show NBSP? Isn't a code editor supposed to remove or show all sorts of markup? I could have never found out otherwise ..

    * considering using Ryder IDE from now on :D
     
    tonemcbride likes this.
  17. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    Jelmer123 likes this.
  18. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    243
    Today I got the following error:
    *** Error: Unable to upload archive. --upload-app is missing one or more required options: --type. (-1027)

    Has Apple perhaps changed their requirements? Should one add the --type parameter?
     
    TheVirtualMunk likes this.
  19. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    Just got the same Error, and I ran a build yesterday without issues, so definitely something new going on here.
     
    Jelmer123 likes this.
  20. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    I had this error today, it's probably because you've set your project to use 'latest xcode' and Unity have just added xCode 13 support for UCB. (in the config signing credentials)

    To fix it you can either change to xCode 12.5.1 or add the new platform option to the 'altool' call in the script:

    Code (CSharp):
    1. if xcrun altool --upload-app -t ios -f $path -u $USER_NAME -p $APPSTORE_PASS ; then
    xCode 13 has added a new '-t' platform option to specify a particular platform to upload (for multi platform apps that share a bundle ID)
     
  21. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    243
    Ah okay, I fixed it with --type. Is that the same?
    For the sake of documentation, my full script is now:
    Code (CSharp):
    1. #!/bin/bash
    2. echo "Uploading IPA to Appstore Connect..."
    3. #Path is "/BUILD_PATH/<ORG_ID>.<PROJECT_ID>.<BUILD_TARGET_ID>/.build/last/<BUILD_TARGET_ID>/build.ipa"
    4. path="${UNITY_PLAYER_PATH}"
    5. if xcrun altool --upload-app --type ios -f $path -u $ITUNES_USERNAME -p $ITUNES_PASSWORD ; then
    6.     echo "Upload IPA to Appstore Connect finished with success"
    7. else
    8.     echo "Upload IPA to Appstore Connect failed"
    9. fi
    10.  
     
  22. mrgoodwin1992

    mrgoodwin1992

    Joined:
    Oct 10, 2019
    Posts:
    1
    Same issue - uploaded without any errors, getting the "Upload IPA to Appstore Connect finished with success" in the full log, but no build visible on appstore connect. :(
    In testflight tab also nothing. Please tell me what could be the problem?
     
  23. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    just add
    Code (CSharp):
    1. --type ios
    to your command
     
  24. mboyle

    mboyle

    Joined:
    Sep 10, 2015
    Posts:
    6
    Curious, will the type be ios for other Apple platforms? Is this something we can pull from the environment (I didn't see something with platform in the provided environment variables.)
     
  25. bhupiister

    bhupiister

    Joined:
    Dec 13, 2019
    Posts:
    42
    @tonemcbride Thank you for the correction of
    1. --type ios
    Just wanted to ask if there is an option to apply a post-processing script without building the entire project again?
     
  26. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    Hi, unfortunately I don't think there is - you'd need to rebuild the project again on cloud build.
     
  27. bhupiister

    bhupiister

    Joined:
    Dec 13, 2019
    Posts:
    42
    Thanks.
    I was finally able to upload it successfully.
     
    tonemcbride likes this.
  28. mrphilipjoel

    mrphilipjoel

    Joined:
    Jul 6, 2019
    Posts:
    60
    I just realized it is 11 years later. Does this method not work anymore? I followed all these steps. My build was successful, but did not show up in app store connect (which is the goal of this, right?). Log shows this error:

    5636: Uploading IPA to Appstore Connect...
    5637: /BUILD_PATH/mrphilipjoel.monster-attack.default-ios/monsterattack/Assets/Editor/post-build-push-ipa-appstore.bash: line 4: path: command not found
    5638: xcrun: error: sh -c '/APPLICATION_PATH/Xcode13_0_0.app/Contents/Developer/usr/bin/xcodebuild -sdk /APPLICATION_PATH/Xcode13_0_0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find altool--upload 2> /dev/null' failed with exit code 17664: (null) (errno=Invalid argument)
    5639: xcrun: error: unable to find utility "altool--upload", not a developer tool or in PATH
    5640: Upload IPA to Appstore Connect failed​

    Edit: I'm not sure why its looking for MacOSX.sdk. This should be an iOS build.
     
    Last edited: Dec 18, 2021
  29. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    It looks like you don't have a space between altool and --upload but I might be wrong. Also worth checking that the bash .sh file only has unix line endings (LF) rather than windows ones (CR+LF) as that sometimes causes problems. Programs like notepad2 or uniscite will let you convert the line endings to LR.
     
  30. mrphilipjoel

    mrphilipjoel

    Joined:
    Jul 6, 2019
    Posts:
    60
    You were right about the missing space. Not sure how that happened. I copied and pasted from the example higher in the thread. Maybe it happened when I opened in notepad++ and made sure the line endings were converted. I tried another build, and got another error. So, I compared what I had in my bash script, to the example here in this thread, and somehow a lot of spaces got moved around.

    The next build after that failed because I did not have an app icon. I added all the icons in unity, did another push, and success! Build is visible in test flight now. I have some other issues that the App Store Flagged, but I think I'm on my way! Thank you!
     
    tonemcbride likes this.
  31. TigerMax

    TigerMax

    Joined:
    Jun 1, 2013
    Posts:
    8
    Hello!
    I can't get it to work.
    There are no errors, but app doesn't appear at testflight.
    Are there any additional settings I have to make in Unity? (except for version, build and id)


    Code (CSharp):
    1. #!/bin/bash
    2. echo "Uploading IPA to Appstore Connect..."
    3. #Path is "/BUILD_PATH/<ORG_ID>.<PROJECT_ID>.<BUILD_TARGET_ID>/.build/last/<BUILD_TARGET_ID>/build.ipa"
    4. path="${UNITY_PLAYER_PATH}"
    5. if xcrun altool --upload-app --type ios -f $path -u $ITUNES_USERNAME -p $ITUNES_PASSWORD ; then
    6.     echo "Upload IPA to Appstore Connect finished with success"
    7. else
    8.     echo "Upload IPA to Appstore Connect failed"
    9. fi
    I've managed to upload with same certificates using XCode, but i don't have constant access to mac.
    Can someone point me to possible solution?

    (I've changed app name to ###)
    Code (CSharp):
    1. 9270: Executing Post-Build Script at Assets/Editor/post-build-push-ipa-appstore.bash
    2. 9271: Uploading IPA to Appstore Connect...
    3. 9272: No errors uploading '/BUILD_PATH/###/.build/last/ioscloud/build.ipa'
    4. 9273: Upload IPA to Appstore Connect finished with success
    5. 9274: WORKSPACESIZE | ARTIFACTSSIZE
    6. 9275: --------------|--------------
    7. 9276: 713.22 MiB    | 140.00 MiB
    8. 9277: Publishing build 18 of 10170857272982/b880c4fa-5560-4154-ab8d-ad293daa1110 for target 'ioscloud'...
    9. 9278: Uploading extra_data/artifacts/icon.png  ...done
    10. 9279: Uploading extra_data/build_report/summary.json  ...done
    11. 9280: Uploading extra_data/build_report/summary.reflected.json  ...done
    12. 9281: Uploading extra_data/build_report/steps.reflected.json
    13. 9282:   ...done
    14. 9283: Uploading extra_data/build_report/files.reflected.json  ...done
    15. 9284: Uploading extra_data/build_report/files.json
    16. 9285:   ...done
    17. 9286: Uploading extra_data/build_report/strippingInfo.json
    18. 9287:   ...done
    19. 9288: Uploading extra_data/build_report/v2.steps.json
    20. 9289:   ...done
    21. 9290: Uploading /BUILD_PATH/Library/Logs/gym/###.log
    22. 9291:   ...done
    23. 9292: Uploading build.ipa
    24. 9293:   ...done
    25. 9294: Uploading build.app.dSYM.zip
    26. 9295:   ...done
    27. 9296: Zipping cache files from Library
    28. 9297: done.
    29. 9298: publishing finished successfully.
    30. 9299: uninstalling iOS credentials for 10170857272###/b880c4###0-4154-ab8d-ad293daa1110 - ioscloud
    31. 9300: MAC verified OK
    32. 9301: Removing certificate...
    33. 9302:   removing: /BUILD_PATH/Library/MobileDevice/Provisioning Profiles/30f4#4492-be5b-cfcb40018861.mobileprovision
    34. 9303: Using /BUILD_PATH/.rvm/gems/ruby-2.4.2
    35. 9304: postbuildsteps finished successfully
    36. 9305: postbuildstatus finished successfully.
    37. 9306: [+] Running with logging option...
    38. 9307: Finished: SUCCESS
    Update:
    Wowzers. I've got an email from apple.
    My build has issue with "Invalid swift support".
    Well, script is working.
     
    Last edited: Dec 20, 2021
  32. ManjitSBedi

    ManjitSBedi

    Joined:
    Mar 8, 2014
    Posts:
    58
    I just went through the process of using the bash script. Needed to add the "--type" parameter.

    Code (CSharp):
    1. --type ios
    Code (CSharp):
    1. #!/bin/bash
    2. echo "Uploading IPA to Appstore Connect..."
    3. #Path is "/BUILD_PATH/<ORG_ID>.<PROJECT_ID>.<BUILD_TARGET_ID>/.build/last/<BUILD_TARGET_ID>/build.ipa"
    4. path="$WORKSPACE/.build/last/$TARGET_NAME/build.ipa"
    5. if xcrun altool --upload-app --type ios -f $path -u $ITUNES_USERNAME -p $ITUNES_PASSWORD ; then
    6.     echo "Upload IPA to Appstore Connect finished with success"
    7. else
    8.     echo "Upload IPA to Appstore Connect failed"
    9. fi
     
    TheVirtualMunk likes this.
  33. ScottAdams

    ScottAdams

    Joined:
    Nov 23, 2016
    Posts:
    72
    The bash script wouldn't work for me until I shut off the Windows Build machines at the bottom of the advanced configuration page. Had me very confused why it kept saying it couldn't find the script. I had made sure it was LF line endings only that wasn't the issue.


    Disable Windows Builders Yes, I'd like to opt out of the new Windows builder infrastructure
     
    TheVirtualMunk likes this.
  34. mrphilipjoel

    mrphilipjoel

    Joined:
    Jul 6, 2019
    Posts:
    60

    Any tips on how to do this same thing, but with a Mac OS X Build?
     
  35. SuperRaffles

    SuperRaffles

    Joined:
    Jul 25, 2019
    Posts:
    13
    I'd just like to say a big thanks to everyone who contributed to this script, as a PC user it's a godsend, otherwise I'd have to buy a Mac literally to upload the ipa and that's it.

    Having said that, annoyingly I am getting a "file cannot be found (-43)" error. I'm using the script as is with environment variables setup, and I called the iOS Target Name in cloud build simply "ios", then of course added that as the value of TARGET_NAME in the environment variables.

    Here is the error message.

    *** Error: Unable to upload archive. The file '/BUILD_PATH/"project id etc"/.build/last/ios/build.ipa' cannot be found. (-43)

    Any ideas what could be causing this? I appear to be doing everything correctly, just using the $WORKSPACE and $TARGET_NAME variables like this: path="$WORKSPACE/.build/last/$TARGET_NAME/build.ipa"

    EDIT - not entirely sure why this happened, maybe random glitch, but using path="${UNITY_PLAYER_PATH}" seems like the best and safest option. After doing this, it worked perfectly.
     
    Last edited: Mar 28, 2022
  36. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    SuperRaffles likes this.
  37. SuperRaffles

    SuperRaffles

    Joined:
    Jul 25, 2019
    Posts:
    13
    Thanks for the quick reply, I was just about to edit my post to say it's fixed after editing the script to reflect the changes posted by @Dunk86 and @Jelmer123.

    The issue I had could possibly be written off as a random glitch, maybe the environment variable and target name didn't sync in time, as I changed them shortly before compiling.

    Either way using path="${UNITY_PLAYER_PATH}" works perfectly, as well as -- type ios.
     
    Last edited: Mar 29, 2022
    tonemcbride likes this.
  38. Harrishun

    Harrishun

    Joined:
    Apr 13, 2016
    Posts:
    59
    Hey all, thanks for your help in sharing this pipeline tool. Currently I'm trying to set up our build process using the bash script on the thread's first page. However, we seem to be running into an issue that after some googling doesn't have a lot of solutions. We are consistently getting the following error:

    However, that value is the correct value, so we have no idea why this might be happening.
    I know it's probably a bit outside the scope of this thread, but I was posting in the hopes that someone has encountered this and potentially knows how to fix it.
     
  39. Sharminator

    Sharminator

    Joined:
    Jul 24, 2020
    Posts:
    4
    How are you guys doing this with the appstore connect api key rather than username/pwd combo?
     
  40. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    711
    I've been using ios-uploader for over a year now and it's worked very well, even if it's a manual process.

    It's open source, but the repo page includes binary links for Windows, MacOS etc.

    If the binary was included in the game repo, I'm wondering if a UCB script could run it post build somehow?
     
  41. Benjamin-Gooding

    Benjamin-Gooding

    Unity Technologies

    Joined:
    Apr 12, 2022
    Posts:
    303
    NPM is installed on the agents, so it is possible for you to use a post build script to install and run that ios-uploader tool
     
    PeachyPixels likes this.
  42. mrphilipjoel

    mrphilipjoel

    Joined:
    Jul 6, 2019
    Posts:
    60
    Greetings! Your bash script has been helping me for over a year now. My last successful cloud build, with auto-upload to appstore connect was 23 days ago. But, for some reason, today, I get the error, "Unable to Upload archive....[file path here] ... cannot be found.

    I haven't changed anything in 23 days. In the console though, on today's built, it output something a little extra, that it didnt' have 23 days ago. Otherwise, the path looks the same.

    In the attached image is my log from today, over my successful log from 23 days ago.

    Any idea what may have changed to cause this slight different and the upload to appstoreconnect to fail?
     

    Attached Files:

  43. mboyle_tp

    mboyle_tp

    Joined:
    Nov 20, 2021
    Posts:
    4
    My uploads are now similarly failing. Looks like the artifact's name changed from "build.ipa" to something based on my build configuration name (e.g. "Project Name Android CI.ipa".) My guess is that my bash script (which may look like yours @mrphilipjoel) is not handling spaces properly. I'll follow up if that fixes it.

    Maybe time to switch over to a pure Fastlane based approach..
     
    mrphilipjoel likes this.
  44. mboyle_tp

    mboyle_tp

    Joined:
    Nov 20, 2021
    Posts:
    4
    mrphilipjoel likes this.
  45. mrphilipjoel

    mrphilipjoel

    Joined:
    Jul 6, 2019
    Posts:
    60
  46. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    216
    Been using UNITY_PLAYER_PATH for a while, but it's still failing bcs the path now is
    '/BUILD_PATH/<ORG_ID>.<PROJECT_ID>.ios-master/.build/last/ios-master/iOS'
    What's your final solution?
     
  47. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    216
  48. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    216
    For everyone else, here's the final script that works with spaces:
    Code (CSharp):
    1. #!/bin/bash
    2. echo "Uploading IPA to Appstore Connect..."
    3. if xcrun altool --upload-app --type ios -f "$UNITY_PLAYER_PATH" -u "$ITUNES_USERNAME" -p "$ITUNES_PASSWORD" ; then
    4.     echo "Upload IPA to Appstore Connect finished with success"
    5. else
    6.     echo "Upload IPA to Appstore Connect failed"
    7. fi
     
  49. MxHush

    MxHush

    Joined:
    Oct 3, 2022
    Posts:
    10
    is there by any chance a way to separate IOS Version number from Android Version number ? like if i Cloud build for IOS i dont need to change the Version number from the editor manually, it will take the Version number from the script directly, and Android Cloud builds will take a separate Version number from certain script as well.

    Thanks in advance
     
  50. Danny327

    Danny327

    Unity Technologies

    Joined:
    Jan 4, 2021
    Posts:
    78
    Hi,
    If you're setting/managing the version numbers for each platform through code, you could use the Platform scripting symbols to set the versions differently depending on the platform.