You should create a ResourceRules.plist and Entitlements.plist with your credentials. After you create and update those files, delete _CodeSignature folder inside the .app file. Then you can run the following process from the command line:
codesign -f -s 'iPhone Distribution: YOUR_DISTRIBUTION_PROFILE_NAME_HERE' --resource-rules ResourceRules.plist --entitlements Entitlements.plist PATH_TO_APP_FILE
Entitlements.plist example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>XXXXXXXXXX.com.xxx.app</string>
</dict>
</plist>
ResourceRules.plist example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>rules</key>
<dict>
<key>.*</key>
<true/>
<key>Info.plist</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>ResourceRules.plist</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>100</real>
</dict>
</dict>
</dict>
</plist>