iosxamarin.formsphotosframework

Cannot build Xamarin.Forms iOS project


I am trying to build our Xamarin.Forms application on Azure DevOps, but it fails for iOS with the following error:

Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Photos.framework/Headers/PHImageManager.h(18,2): error GB12A9FDE: "Photos requires C++11 or later" [/Users/runner/runners/2.159.2/work/1/s/My_MobileApp/My_MobileApp.iOS/My_MobileApp.iOS.csproj]

The app was originally created on VS 2017, then migrated to VS 2019. It worked, but stopped building yesterday for some reason.

What can I do to fix it?


Solution

  • OK, it is resolved:

    We added a command line task prior to the xamarin.ios build task with the following inline script:

    /bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'$(xcode.root);sudo xcode-select --switch $(xcode.root)/Contents/Developer"

    and set a variable named xcode.root to /Applications/Xcode_10.3.app in order to override the faulty version of xcode on the build agent This is kind of hacky, so once the issue is resolved upstream we will need to remove that override.