Unity publish iOS archive failed use of undeclared identifier in unitynotificationmanager.m

Trying for the first time to publish my app into iOS via Mac XCode and during Archive generation I got a Failed message and the above error.
Item missing is
UNAuthorizationStatusProvisional

Did I miss something from the
Publishing for iOS - Unity Learn
Steps?

Tried: adding definition of this as a BOOL in the associated h file did not resolve the “not defined” error message. Doing a find in project only found my definition and the line where the error occurred. I am lost now. (:

Hi,

The problem is most probably because you are using Xcode 9 or earlier. This is a bug in Unity’s mobile notifications package which has iOS code compatible only with Xcode 10 or later. They use API unsupported in Xcode 9 here and this causes the compilation error you are observing.

To fix it for your setup, go to UnityNotificationManager.m in Xcode and changeif (authorizationStatus == UNAuthorizationStatusProvisional) to if (authorizationStatus == (UNAuthorizationStatus)3)You will need to do that every time you export Xcode project from Unity.

For a long term fix, you can either update Xcode version or write build postprocessing script to change UnityNotificationManager.m automatically.

Hope that helps!

Thank you that explains a lot for me.
I also came a cropper with the app store minimal requirements so submitting and app for an older version is now blocked by those requirements so I have gone with xcode 12.