presumably you're using cocoapods? I had to manually set 'Automatic manage signing' & respective team then it finally worked. Thanks for the pointers from other commenters. For me - there's two development Teams working on same project - so not sure this solution is going to be best. Need to find way to do this at Podfile level.

N.B. I'm on cocoapods - 1.2.0
UPDATE - try this / edit Podfile and add to bottom.
run Pod install
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
end
end
IF THE ABOVE DOESN'T WORK - ONLY try this ( you may need to adjust to latest SDK
eg. iPhoneOS10.2.sdk n.b.
P.S. some body said they had to run PlistBuddy as sudo /usr/libexec/PlistBuddy)
killall Xcode
/usr/libexec/PlistBuddy -c "Set :DefaultProperties:CODE_SIGNING_REQUIRED NO" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist\n
/usr/libexec/PlistBuddy -c "Set :DefaultProperties:AD_HOC_CODE_SIGNING_ALLOWED YES" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist\n
/usr/libexec/PlistBuddy -c "Set :DefaultProperties:CODE_SIGNING_REQUIRED NO" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/SDKSettings.plist\n
/usr/libexec/PlistBuddy -c "Set :DefaultProperties:AD_HOC_CODE_SIGNING_ALLOWED YES" /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/SDKSettings.plist\n
xcodebuild clean build