Search Unity

[Question] How can I use UCB to create an iOS build folder (NOT an .ipa file)?

Discussion in 'Unity Build Automation' started by thecloudkeeper, Sep 28, 2021.

  1. thecloudkeeper

    thecloudkeeper

    Joined:
    Sep 21, 2021
    Posts:
    28
    Hi,

    I'm trying to utilize Unity Cloud Build to export an iOS build folder identical to the one produced by a local build from the Editor.

    I understand that UCB uses Fastlane to create a .ipa file. However, I'm looking for a way to bypass or disable that part of the Cloud Build process so I'm left with the normal folder. The reason for this is that I'm embedding my Unity build in a larger native iOS project. I need the standard build folder, not the .ipa file, so I can place it inside the container Xcode project.

    Thank you. I'd appreciate any advice you might have.
     
  2. dirty-rectangle

    dirty-rectangle

    Joined:
    Apr 23, 2015
    Posts:
    78
    We use a PostExportMethod to zip the exported project path directory (which is passed as an argument) and then save that zip out in the exported project path directory Data folder.
    Then when the build completes you can download and extract the ipa to get the xcode project zip file.
     
  3. thecloudkeeper

    thecloudkeeper

    Joined:
    Sep 21, 2021
    Posts:
    28
    Hey, thank you for the response -- super helpful.

    Would you mind sharing what class you're using to zip your project folder? I gave it a shot with ZipFile.CreateFromDirectory (inside System.IO.Compression) but it threw an "IOException: Sharing violation on path [...etc...]". I imagine this was happening because I was trying to place the .zip file into the same folder I was compressing. If you could give me any pointers so I can find a solution similar to yours, that would be amazing. Thank you!
     
  4. dirty-rectangle

    dirty-rectangle

    Joined:
    Apr 23, 2015
    Posts:
    78
    https://github.com/r2d2rigo/dotnetzip-for-unity

    public static void AppBundlePackXCodeProj(string exportedProjectPath)
    {
    DebugLog("Archive xcode project...");
    using (ZipFile zip = new ZipFile())
    {
    zip.AddSelectedFiles("*", exportedProjectPath, string.Empty, true);
    zip.Save("project.zip");
    }
    try
    {
    File.Move("project.zip", exportedProjectPath + "/Data/project.zip");
    }
    catch (IOException ex)
    {

    }
    }
     
  5. thecloudkeeper

    thecloudkeeper

    Joined:
    Sep 21, 2021
    Posts:
    28

    Thank you!
     
  6. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    As far as I am aware, the IPA file is a ZIP file.

    I've previously renamed one from IPA to ZIP then extracted its contents as normal.