'Phase Script Execution causing me Archive failed. Btw App is running on test device

I am trying to Archive an app from a new mac but it gives a phaseScriptExecution error all the time. Btw it can be built and run on a test device. Tried many solutions from google for hours and hours before posting this question. none of them were worked. Please help me.

I have 2 run scripts file only

enter image description here

enter image description here

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source