None of the above answers worked for me. This was because the error was caused not by the parent app or it's extension. Rather one of the linked libraries was at fault.
To confirm, first archive using Xcode then using Organiser select the entry and locate using Show in Finder. This will show the .xcarchive
file.
Select that file and choose "Show Package Contents".
Select the .app in the Products/Applications folder and again choose "Show Package Contents".
Locate the offending module in the Frameworks folder. For example if the error is:
ERROR ITMS-90206: "Invalid Bundle. The bundle at 'MyApp.app/Frameworks/MyLib.framework' contains disallowed file 'Frameworks'."
Then in the Frameworks/MyLib.framework
the following will probably be visible:
../Frameworks/libswiftContacts.dylib
../Frameworks/libswiftCore.dylib
../Frameworks/libswiftCoreData.dylib
../Frameworks/libswiftCoreGraphics.dylib
../Frameworks/libswiftCoreImage.dylib
../Frameworks/libswiftCoreLocation.dylib
../Frameworks/libswiftDarwin.dylib
../Frameworks/libswiftDispatch.dylib
../Frameworks/libswiftFoundation.dylib
../Frameworks/libswiftLocalAuthentication.dylib
../Frameworks/libswiftObjectiveC.dylib
../Frameworks/libswiftPassKit.dylib
../Frameworks/libswiftUIKit.dylib
../Frameworks/libswiftWebKit.dylib
These are present because the linked library - or module - that the parent app includes has the EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
Locate the dependent module in Xcode and update the flag:
Note that having overcome this issue the app may still be rejected with an explanatory email from the iTunes Store:
Invalid Swift Support - The Watch OS application has Swift libraries at both...
Again this comes back to the EMBEDDED_CONTENT_CONTAINS_SWIFT
flag. Ensure that only the parent app has this set to YES
. Both the WatchKit app and extension must have this flag set to NO
. This is as detailed in @Mike's answer above.