Unity Sample App build for iOS stuck

leo
leo Posts: 1

Hello guys. We were trying to use the new Unity Sample App for camera kit to build for iOS and I am stuck at building. I followed instructions to build for iOS from [https://github.com/Snapchat/camera-kit-unity-sample/] using Windows 11 machine and stuck with the below error

[Win32Exception: ApplicationName='/usr/local/bin/pod', CommandLine='install', CurrentDirectory='D:\camera-kit-unity-sample-main\unity\exports\unity-ios-export......\app-ios', Native error= The system cannot find the file specified.
]

  • I just cloned the repo [https://github.com/Snapchat/camera-kit-unity-sample/] from github.
  • I used the correct unity version.
  • And I tested without changing any code in the repo rather than adding the correct api token and app id.
  • I used Windows 11 PC and targeted to build for iOS.

Thank you very much for any workaround or fix suggestions.

Answers

  • Edgar Neto
    Edgar Neto Posts: 9 👻

    Hi Leo,

    Thanks for posting your question here.
    This is a good catch, I don't think we tested enough on Windows.
    I can see that the path for where it's looking for cocoapods is looking weird: all the dots after unity-ios-export, that doesn't look right. It tries to concatenate an absolute path to a relative path, so it should look something like this: 'D:\camera-kit-unity-sample-main\unity\exports\unity-ios-export\..\..\..\app-ios', which seems to work alright in a unix based system.
    Gladly that path is configurable in the CameraKit Settings dialog. So here's my recommendation: in the Camera Kit Settings dialog inside of Unity, try to replace the Xcode Wrapper Path from ../../../app-ios to ..\\..\\..\\app-ios and see if it works. Alternatively, keep experimenting with escape characters to see if that build step passes.

    Here's some additional information to note:
    1. I'm not sure whether or not Unity officially supports building to iOS from a Windows machine
    2. The step that is failing is that our post-processing scripts are trying to execute pod install in the wrapper app. If that keeps failing, you can comment-out line 217 of of CameraKitSettingsWindow.cs (where it attempts to run Cocoapods) and run it manually by invoking pod install on that folder. This will have the same effect. Again, I'm not quite sure about the support of Cocoapods on Windows, but I'm hoping that this is something you looked into to ensure you can build to iOS from Windows.

  • YassAR
    YassAR Posts: 6
    edited October 2023 #3

    Hi All

    So I have the same problem but I am using a Mac mini and like Edgar told about building iOS apps from a windows pc it's indeed impossible to do I already build apps for both android and iOS and for iOS you always need a Mac !

    About the issue: So in my case I tried different escape characters and it didn't work so I tried to do it manually and I got a Not found error: "zsh: command not found: pod" and now I am trying to install "pod" maybe the issue originates from here ? ! ?

  • Edgar Neto
    Edgar Neto Posts: 9 👻

    Hi Yassine. Thanks for your contribution to the forum.

    Yes that's correct. You need to have cocoapods installed for the unity wrapper to work. It will try to run Cocoapods automatically as part of the postprocessing build. But this is ultimately just for convenience. If the postprocessing build is giving you any trouble, feel free to comment-out these lines in Scripts/CameraKit/Editor/CameraKitSettingsWindow.cs:

    [PostProcessBuild]
        static void OnPostProcessBuild(BuildTarget buildTarget, string pathToBuiltProject)
        {
            Debug.Log("iOS: Post process started");
            Config = ReadSettingsFromDisk();
            iOSTask_ConfigureInfoPlist(pathToBuiltProject);
            iOSTask_ConfigureXcodeProject(pathToBuiltProject);
            // iOSTask_RunCocoapods(pathToBuiltProject); // <-- Comment-out this line 
            Debug.Log("iOS: Post process finished");
        }
    

    And then navigate to app-ios/ in your terminal and execute cocoapods manually by running pod install

    Let me know if that works for you.