ChatGPT解决这个技术问题 Extra ChatGPT

Validation Error: Invalid Bundle. The bundle at ... contains disallowed file 'Frameworks'

I'm trying to submit an app with the Xcode 6 GM, and I get this error on validation. The app has an action extension and a dynamic framework that's shared between the extension and the app itself.

I don't have a file called 'Frameworks' anywhere in the project, so I'm really not sure what this is supposed to mean. Has anyone gotten this issue or have any ideas?

https://i.stack.imgur.com/YjRpt.png

Archive validation failed due to the issues listed below. iTunes Store operation failed. Invalid Bundle. The bundle at ... contains disallowed file 'Frameworks'.

How about a folder named Frameworks?
There's a 'group' in the project called Frameworks, but no folder. I removed it, re-archived, and I still get the same error.

R
Rob Zombie

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

You are my savior. "Embedded" means extension in bundle, and since an extension does not contain more extensions, it does not contain swift code.
This didn't resolve the issue for me. I'm also using CocoaPods. Has anyone seen issues relating to that? Any other ideas?
Don't forget with WatchKit extensions to make sure that the Runpath Search Path has @executable_path/../../Frameworks
@MrRogers This is what solved my issue after following the answer. I have an objC app with swift watch. Would run fine without setting the embedded content, however it got a rejection from apple. Setting the embedded content correctly, broke the app. This search path is what fixed it.
This not worked for me, I needed to do something else and was on the Target extension that has the issue, I erased the script on "[CP* Embed Pods Frameworks" after this It works correctly!!
j
johnnieb

The only solution that worked for me was to add this Run Script to the App Extension target:

cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
if [[ -d "Frameworks" ]]; then 
    rm -fr Frameworks
fi

https://i.stack.imgur.com/QHgrm.png


My app does not use Swift so this was the only fix that worked for me too.
Worth mentioning that this only needs to be added to the extension, not the main target.
This indeed solves the issue, but it gives another issue which is I cannot run my app on simulator neither on my device. It gives an error: dyld: Library not loaded: ... Image not found Anyone can help me?
Is it just me or is this kind of insane?
Fixed on validating .ipa but crashing on installing with error message: dyld: Library not loaded: @rpath/AFNetworking.framework/AFNetworking Referenced from: /var/containers/Bundle/Application/.... Reason: image not found
R
RawMean

So 3 steps to fix this from build settings

Container App: Embedded Content Contains Swift Code: YES Extension: Embedded Content Contains Swift Code: NO Extension: Runpath Search Path = @executable_path/../../Frameworks


Container vs Extension, I am new to Xcode. where is that, are extension cocoa pods? or where are these two things located?
This one worked really well but the setup in XCode now is named "Always embed swift standard libraries", it took me some time to figure it out :P
D
Dan Loughney

In my case, I just upgraded to CocoaPods 1.0.1 and this appears to be a new bug.

The Pod update adds a run script to my Extension's target which creates the Frameworks folder. I found it as I was about to add @Roman's run script to remove it.

Solution was to delete this script from my extension's build phase. Here is the one which needed to go...

https://i.stack.imgur.com/vO8pY.png


Solved it for me! Once again it's CocoaPods costs me over an hour of trying to figure out what's wrong. I have a serious love-and-hate relationship with that product.
Upgrading Cocoapods to 1.1.0.rc.2 solved the problem for me.
Deleting the Embed Pods Frameworks under the Keyboard extention's Build Phases worked for me! I'm using Xcode 8 and CocoaPods v1.0.1. Thanks!
B
Bartłomiej Semańczyk

Remove Every Build Phase for your extension that has embed word in its title.

Additionally:

Embedded content contains Swift code must be set to Yes for the extension target.


M
Max MacLeod

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:

https://i.stack.imgur.com/cgnWP.png

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.


s
suztomo

https://i.stack.imgur.com/USetc.png


P
Pim

In my case the solution was to remove my framework from my extension's Embedded Binaries and add it to my extension's Linked Frameworks and Libraries. (Both can be found in the extension's General tab.)


C
Community

If Embed Pods Frameworks script and Roman's script both exist in the same target.

Please check if the Embed Pods Frameworks locates before the other one. If not, just move Roman's script to the last.


you're amazing @Reeonce Zeng, save my day!
Should i kept both script there or only the last part ? "${SRCROOT}/Pods/Target Support Files/Pods-Orsys WatchKit Extension/Pods-Orsys WatchKit Extension-frameworks.sh" cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" if [[ -d "Frameworks" ]]; then rm -fr Frameworks fi
@stack, you should add a new run script phase, and fill with: ` cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" if [[ -d "Frameworks" ]]; then rm -fr Frameworks fi `
what do you mean by run new script ? we already have a script there. ok ? replacing the old script , should i run once the project with replacing your text. DO i need to select the option "run script when installing the program" there ?
please, help me a bit more. I got the error for wathckit extension. In my watchkit extension project, there is no "fix the appex contains disallowed ..." option/menu/tab in my projects. where i can find it ? I have only "Embed pods framework" and "copy pods framework". Please, help.
K
Kudit

I was unable to find any settings for Embedded Content Contains Swift Code but I was able to find a setting Always Embed Swift Standard Libraries and setting this to NO for my framework did fix this issue.


N
Narasimha Nallamsetty

the above answers did not work for me. I have done below things.

copied target settings of extension from other developer from the team Container App: Embedded Content Contains Swift Code: YES Extension: Embedded Content Contains Swift Code: NO

Please check every setting of extension from the Target.


Thanks! This solved it for me. This solution ensures that a framework is only included once in the app bundle.
K
Kurt J

If you're using CocoaPods, I would consider deleting the Embed frameworks build phase on the problematic target (the extension), this fixed the problem for me.


Y
Yongxiang Ruan

Container App: Build Setting -> Embedded Content Contains Swift Code: YES Extension: Build Setting -> Embedded Content Contains Swift Code: NO Extension: Build Phase -> added the following Run Script in

cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" if [[ -d "Frameworks" ]]; then rm -fr Frameworks fi

(important)Extension: Build Phase -> move the Run Script to the Last (after Embed Pods Frameworks script )


"to the Last" was the important piece for me, thanks.
Z
Zatman

I was getting the same error, and it is because I was copying the framework into the extension bundle. As it turns out, frameworks that are used by the extension should be copied into the Main App bundle and only linked in the extension build settings (not copied). Be sure to have the search path '@executable_path/../../Frameworks' in the extension build. I think that path was added automatically by XCode 10.


T
Travis M.

None of the Build Settings listed here resolved this issue for me. However, I did get this to work after moving some frameworks from "Embedded Binaries" to "Linked Frameworks and Libraries".

It appears that my main app and one of my custom frameworks had the same framework dependency in both and that seems to be a No No but moving it in my main app from the Embedded area to the Linked area allowed me to upload the app successfully with no errors.


A+ I also had a custom framework that had the same dependency as the app!
B
Belle B. Cooper

I found lots of questions like this and none helped me fix my problem, so hopefully this might help someone.

I'm creating an app that has an Intent extension (for Siri shortcuts) and I'm using a framework for code shared between the extension and my app, as recommended by Apple.

I had added my framework to my extension in the "Frameworks and Libraries" section of the "General" settings for the target. When you add a framework here, there are two columns. One says the name of the framework and the other is titled "Embed". I had nothing showing up in the "Embed" column so I thought that was fine, but I had to explicitly choose a "Do Not Embed" option for that column for my framework. When I did that and archived in Xcode, I could see during validation that the framework wasn't listed in my ipa content under each target anymore, but just once, and validation succeeded finally.


J
Juan Sagasti

In my case, Firebase SPM was the culprit. I have a ShareExtension that was failing AppStore validation because of the frameworks folder. I fixed that with a post-archive script in the schema:

https://i.stack.imgur.com/pjv3h.png


В
Владимир Ефанов

For Unity3D

Set "Always Embed Swift Standart Libraries" to YES for the Unity-iPhone target Delete Framework folder inside your .xcodearchive (see picture) path to archives ~/Library/Developer/Xcode/Archives

https://i.stack.imgur.com/KdHtH.png

https://i.stack.imgur.com/3bPEE.png


a
andreacipriani

I had this problem the first time with XCode 7.1.1 for my app that has a Today Extension (there is no Swift in my project). The script (https://github.com/CocoaPods/CocoaPods/issues/4203) didn't work for me.

Downgrading cocoapods to version 0.39.0.beta.3, running pod install, and then re-archiving solved the problem.


S
Stephen Rauch

I was getting this same error, along with a

Disallowed nested bundles error

My problem was with the SquareReaderSDK.framework specifically but I had to add a new run script per their instructions:

FRAMEWORKS="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}"
"${FRAMEWORKS}/SquareReaderSDK.framework/setup"

M
Moran77

You should remove embedded frameworks from all pods and extension like in describe in: https://stackoverflow.com/a/40396491/2559850


В
Владимир Ефанов

You have to add script to the end of Build Phases

cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
if [[ -d "Frameworks" ]]; then 
    rm -fr Frameworks
fi

https://i.stack.imgur.com/l72Dw.png