I was getting the same error when I read the error below these line I find the actual issue and the problem was solved. in my case I was building flutter app from command line.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: