'Can't archive with Xcode (error - PhaseScriptExecution failed with a non zero exit code), but the build is successful

I am sorry for the black marks in the image.
I have seen multiple posts suggesting an answer to this problem, Lock unlocks keychain (tried it), pod Update (tried it), clear build(tried it), signing, skip install in build settings(tried it) - None of them actually worked.
I built my iOS app in react native with Expo, after which I did expo eject to create the iOS folder for Xcode build and archiving, the build is successful every time and it even runs on the simulator and in my device(iPhone 7) but it always failed to archive by throwing this error - Uncategorised - Command PhaseScriptExecution failed with a non zero exit code..
Any help to point me in which direction should I go or what can be the possible mistake that I am doing will be of great help. Do let me know if, I should provide any more detail about this. Thank you!
Xcode Version - 11.0 Mac Version - 10.15 Catalina iPhone OS - 13.1.3
Few links I tried from -
Solution 1:[1]
Make sure you have installed your pods correctly. For me I removed all the pods from my pod file, updated the pod through the terminal, then re-added the pods to the pod file and installed through the terminal. This worked perfectly for me.
Solution 2:[2]
I had the same exact problem. What worked for me was I opened the podifle and deleted all the pods, then saved it. After that run pod update in terminal. Go back to the podfile and past the pods back into the file and save it. Then run pod update in terminal again. After that open xcode and run the cleaner and then try to Archive...it worked for me.
Solution 3:[3]
Based on the previous answers, the following worked for me:
- Quit XCode.
- Delete all relevant files:
Podfile,Podfile.lok,Podsfolder and.workspacefile. - Recreate the
Podfileand open the new.workspacefile.
Cheers
PS: In my case, I hit this issue after copying an existing project (workspace) to a new machine.
Solution 4:[4]
Try go to accounts and press download manual profilesenter 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 |
|---|---|
| Solution 1 | savytech |
| Solution 2 | Mike Beaulieu |
| Solution 3 | |
| Solution 4 | Yaroslav Pesotskii |
