I think figured it out.
There's a problem if you've had a development version of the app on the device.
If you uninstall the app completely and restart the device the update / installation from appstore or testflight will work fine.
On devices which never had a development version installed, the error didn't occur.