xcbuild in Xcode Run-Script fails although terminal script works

Hi,


I have a problem which I'm trying to solve in the last few weeks with no luck.

I have a workspace contains two projects:

1. A static library which creates a fat framework

2. My main app which includes this framework.


Until today I always went to the static library project and built it using aggregated target which builds iOS and simulator and combines them with lipo.

This works fine. I then take the .framework and import it into my app with no issue.

Lately I wanted to save the need to build the framework from its own project so I added a Run Script to my app's target which runs the same aggregation but from my app project and not the framework project, so each time I build my app I will get the latest framework build.

This one however is not working and I'm getting build errors, especially related to entitlements missing ("CodeSign error: entitlements are required for product type 'Bundle' in SDK 'Simulator - iOS 9.2'. Your Xcode installation may be damaged" or "[BEROR]CodeSign error: entitlements are required for product type 'Static Library' in SDK 'Simulator - iOS 9.2'. Your Xcode installation may be damaged.")


Same script running from termial works fine. Only when I shoot it from a Run Script it will not work.


I'm using Xcode 7.2 and support deployments from iOS6.


Any help will be appreciated.


Thanks.