How do you build for iOS on Windows and compile/deploy on a Mac?

Posted initially to the forum but Answers is probably better suited:

  • Generate build for iOS (on Windows)
  • Copy resulting xcode project folder
    across to Mac Load project in XCode
    and build
  • => Linker errors due to missing lbraries; as far as I can see
    anything 3rd party (facebook, flurry,
    Etcetera2…etc)

When comparing the project files generated when building locally (on a Mac) to the one built on the Windows PC it is clear that these libraries are not included in the build at all.

Has anybody (in particular from Unity) been able to do this and make it work?

One thing is definitely broken on the Unity side when building a project; if you are using 3rd party plug-ins which require a postbuild step then these steps are not invoked on Windows which means that you can not take the Xcode project as-is.

The solution I’ve tried so far is to invoke the postbuild step on a Mac on the Xcode project that was built with Unity on a PC. So far this does not seem to work very well for the plug-ins we’re using (Prime31) and I’m in conversations with Prime31 about their build solution to try to narrow it down and understand if its due to an issue with the Xcode project Unity generates or something else.

It would be very nice if somebody from Unity could take a look at this…

I can’t speak to your specific code, but typically, the “post-build” scripts for Unity iOS projects are invoking the Xcode on the command line in order to make changes to the project files. It is not possible to make this work on PC.

Your best option is to do the build from Unity on the Mac. If this is not possible for some reason (licensing, perhaps) the only other option I can think of is writing code yourself to parse and modify Xcode project files. This isn’t super difficult since Xcode project files are essentially just plists, but making sure you get all the options exactly right will take some time. You will probably also have to modify the post-build scripts from the plugins you are using to refer to your new project-modifier-thingy rather than calling out to Xcode (unless you copy the Xcode CLI exactly and create your own standalone executable…). It’s not impossible, but it won’t be easy.

If you still having the issue, or if anyone on the internet come here through Google search here is the thing.
When you build on Windows for iOS a lot of plugins add stuff to xproj through PostProcessBuild calls, and inside them they use System.IO.Path.Combine(path1, path2) method, which will add to parts of the path together using default system path separator, and on Windows it is "" so when XCode tries to link libraries he can not find them, because path is not correct. Way to fix this is to write your own PathCombiner that will use “/” as separator and replace calls in plugins PostProcessBuild scripts to this.
I have no idea why all major plugins still didn’t fugure this out, that includes Facebook, Chartboost and other big companies but there you go, it should fix you thing.