Turns out the error is related to using Swift (both the app and the extension make use of Swift).
For the app, I had to set:
Embedded Content Contains Swift Code: YES
and for the extension:
Embedded Content Contains Swift Code: NO
Xcode 8 and 9
Looks like this has been renamed to Always Embed Swift Standard Libraries
in Xcode 8 and 9. So, for the app:
Always Embed Swift Standard Libraries: YES
and for the extension:
Always Embed Swift Standard Libraries: NO