When deploying our project to iOS, I've been using various methods of UnityEditor.iOS.Xcode.PBXProject in a [PostProcessBuild] method to apply a few fixes to the generated Xcode project before the Xcode build begins. Because our project also deploys to other platforms, I had previously wrapped anything that touched the UnityEditor.iOS.Xcode* types in a '#if UNITY_IOS' '#endif' pair to avoid generating any errors.
This approach has been working successfully between 5.5.0f3 and 2017.3. As of 2018.1, however, the code inside the UNITY_IOS branch stopped executing. It looked like the UNITY_IOS define either wasn't being set, or the postbuild step wasn't being re-evaluated with the define set. I tried several variations on AssetDatabase.ImportAsset in an attempt to force the code to be re-evaluated (hopefully with UNITY_IOS in place), but these all seemed to cause crashes.
In the end, I had to resort to reflection to get this to work, but I was wondering if anyone knows of any better solutions? Using UNITY_EDITOR_OSX should also work, but IIUC this would still have problems if the user had installed Unity on OSX without iOS support. I've been running 2018.1.0f2 against macOS High Sierra 10.13.4.
Thanks very much for any help you can give,
John