Xcode sandbox error when building for iOS

When building the Flutter app for iOS, you may come across this error:

To fix this:

  • Open the project in Xcode and go to the build settings
  • Select "all" and type "sandbox" in the search filter
  • Set the "User Script Sandboxing" value to No