Symptoms
- I am getting build errors when building my iOS project in Unity Build Automation (UBA) appearing in the Xcode project build phase.
Cause
Most Xcode build failures in Unity Build Automation are related to 3rd party plugins, specifically those that require a certain minimum version of Xcode or that you have bit code disabled. In addition, there are other potential points of failure as noted in the resolution section below.
Resolution
Generally, the first step is to ensure you can build your project locally in the desired version of Xcode using the same settings (without modifying the Xcode project unless you are doing the same modifications via post-export script in UBA).
Build errors can occur if the post process cannot find the Xcode project and cannot add the appropriate libraries. That path should be passed to OnPostProcessBuild, but your plugin probably does not use it in its post-build process. You need to do this manually with the XCode API.
Some third-party plugins or your own code require modifying the XCode project to add libraries or files, which can be done using post-process attributes and the Scripting API.
There are several Discussions posts available, which can help to solve different issues related to iOS projects:
- Add frameworks via post-process scripts to the XCode project.
- Add items to info.plist via post process scripts to the XCode project.
- Add other linker flags for missing libraries in 3rd party tools.
- Activate iCloud settings.
- Add security Frameworks.
- XCode Frameworks.
More Information
How to build locally in batchmode
Disabling bitcode in a Unity Project