building IPA with command line (missing scheme)

Problem is that the Xcode scheme file (Unity-iPhone.xcodeproj/scuserdata/username.xcuserdatad/xcschemes/Unity-iPhone.xcscheme) is generated after I open a freshly generated Unity Xcode project. When I try to build and archive with xcodebuild I get the following error: "The project ‘Unity-iPhone’ does not contain a scheme name ‘Unity-iPhone’.

I want to integrate the steps to build an IPA into my CI. That’s why I don’t want to open Xcode manually at all.

Does anyone know a solution?

I’m running into the same issue. My current workaround is to open Xcode manually in command line and then delay to give it chance to generate the scheme.

i.e.

open OurProj.xcodeproj
time.sleep(5)

I’d love to know a better solution.