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

22

204

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?

here's what the error looks like

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

Tacmahack answered 11/9, 2014 at 2:12 Comment(2)
How about a folder named Frameworks?Fescennine
There's a 'group' in the project called Frameworks, but no folder. I removed it, re-archived, and I still get the same error.Tacmahack
T
370

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
Tacmahack answered 11/9, 2014 at 13:46 Comment(16)
You are my savior. "Embedded" means extension in bundle, and since an extension does not contain more extensions, it does not contain swift code.Impede
This didn't resolve the issue for me. I'm also using CocoaPods. Has anyone seen issues relating to that? Any other ideas?Acrimonious
Don't forget with WatchKit extensions to make sure that the Runpath Search Path has @executable_path/../../FrameworksOptics
@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.Panocha
This is really unnecessarily confusing, and it's all due to the inept phrasing of the setting text.Smokedry
This also works for embedded framework targets used in other apps.Gouache
This did not work for me unless I also added Roman's Run Script build phase below. We use Cocoapods and have Swift code in the app and imported by the Today Extension.Langham
there is no such settings for watch app extensionEdgardo
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!!Mohamedmohammad
I have pods. What is the config for the pods? Always Embed Swift to Yes or to No??Caton
I am also facing same kind of issue ERROR ITMS-90362: "Invalid Info.plist value. The value for the key 'CFBundleExecutable' in bundle Giftxoxo.app/PlugIns/ServiceExtension.appex is invalid. CFBundleExecutable must match the name of the bundle directory minus its extension.” ,this I set it to no but i am getting the same error ,it is for notification service extensionTavares
I just had to do the part for the extension, the original app also has "NO" set there. It's fully working.Inaction
For what it is worth, in my case, I set the above to NO for the three targets which make up my app (it is a Unity app, so: i. main target, ii. UnityFramework, iii. Keyboard extension). This resolved the error for me.Halcomb
If you're using Unity and encountering this issue: try changing Always Embed Swift Standard Libraries to "No" specifically for the UnityFramework target. Doing this validated for me on 2020.3.16f1 (LTS).Rupertruperta
This does not solve my issue, I am using Swift package manager for all my dependencies. I need to manually delete the folder in order to send app to TestFlight.Viewing
Worked! Thank you! You are a god! For those new to Xcode like myself, here is how you get to the settings he is referring to. Xcode -> In the Unity-iphone - Build Settings -> Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: YES In the UnityFramework - Build Settings -> Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: NOSolfa
A
127

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

enter image description here Source: https://github.com/CocoaPods/CocoaPods/issues/4203

Autotype answered 13/10, 2015 at 0:48 Comment(20)
My app does not use Swift so this was the only fix that worked for me too.Otilia
Same - No Swift in my app, and this fix worked for me.Kaylor
I had to add this script to both app extension and watch extensionMimicry
This is the only fix that worked for me. No Swift code being used anywhereCymbre
The script worked for me as well. Seems to be a known issue with Cocoapods.Willams
Worked for me (Xcode 7.2, app with Today widget and watch extension). ThanksKareenkarel
The script removes the empty 'Frameworks' from my app extension so I have been able to submit. But I don't know why it exists. Does someone know what's happening behind the scene?Kneehigh
A. Should i kept both script there or only the last part ? B. Should i also check the option enable from two (1. show enviromental variable, 2. Run script only installing )? "${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 fiAshcroft
No swift in my code and that's the only thing that helped me.Corene
I had to do this AND set Embedded Content Contains Swift Code: NO on the Today Extension in order to get it uploaded successfully.Langham
Worth mentioning that this only needs to be added to the extension, not the main target.Kornher
its really helpful answer. I get same issue and just adding that run script in my notification extension that works for uploading. + for youOrder
The script needs to execute after other run scripts such as a CocoaPods. I came across a project that already included this script, but moving the script to the end of the build phases solved the problem.Cerebro
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?Hyderabad
Is it just me or is this kind of insane?Khania
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 foundMammiemammiferous
Removing a framework your app needs, means it will crash when trying to use anything in that framework. So if you install this script you should also delete all of the code in the app that references the framework... how that helps solve the problem I am not sure.Cupronickel
Worked while using flutter plugins.Doxy
You will probably want to copy all the frameworks first to the ipa root frameworks folder before removing the nested framework folder.Rainie
The script does not delete 'Frameworks' folder from app extension for me. I need to manually delete the folder in order to send app to TestFlight.Viewing
O
51

So 3 steps to fix this from build settings

  1. Container App: Embedded Content Contains Swift Code: YES
  2. Extension: Embedded Content Contains Swift Code: NO
  3. Extension: Runpath Search Path = @executable_path/../../Frameworks
Oona answered 23/4, 2015 at 11:7 Comment(2)
Container vs Extension, I am new to Xcode. where is that, are extension cocoa pods? or where are these two things located?Pale
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 :PMenu
O
16

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...

enter image description here

Otilia answered 2/7, 2016 at 14:55 Comment(3)
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.Kalong
Upgrading Cocoapods to 1.1.0.rc.2 solved the problem for me.Amphiprostyle
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!Mcgean
R
15

In my case, there was one CocoaPod library "Blockly" that was specifying Yes for "Always Embed Swift Standard Libraries". After making NO for the option, it worked.enter image description here

Rounded answered 17/1, 2017 at 2:38 Comment(0)
N
14

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.
Nervine answered 5/11, 2015 at 19:43 Comment(0)
B
12

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:

enter image description here

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.

Blind answered 12/7, 2016 at 14:22 Comment(0)
B
10

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.)

Beauregard answered 2/8, 2015 at 16:18 Comment(0)
C
7

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.

Communard answered 24/2, 2016 at 1:48 Comment(8)
you're amazing @Reeonce Zeng, save my day!Vin
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 fiAshcroft
@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 `Communard
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 ?Ashcroft
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.Ashcroft
@stack, that is why you need to add a new run script phase, just find the "+" symbol, and click on that!!!Communard
ha ha, Now say, from which tab i have to choose ? "Embed pods framework" or "copy pods framework" ? :PAshcroft
This worked for me as well! Don't forget to check order of Run scripts for all targets (WatchKit, Today widget).Canaigre
B
7

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.

Bucky answered 16/10, 2016 at 20:18 Comment(0)
D
5

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

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

Please check every setting of extension from the Target.

Dorso answered 11/10, 2020 at 10:19 Comment(1)
Thanks! This solved it for me. This solution ensures that a framework is only included once in the app bundle.Breathed
W
4

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.

Wend answered 21/9, 2016 at 1:30 Comment(0)
T
4
  1. Container App: Build Setting -> Embedded Content Contains Swift Code: YES
  2. Extension: Build Setting -> Embedded Content Contains Swift Code: NO
  3. 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

  1. (important)Extension: Build Phase -> move the Run Script to the Last (after Embed Pods Frameworks script )
Tierratiersten answered 22/9, 2016 at 22:8 Comment(1)
"to the Last" was the important piece for me, thanks.More
S
3

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.

Smithereens answered 9/5, 2019 at 23:38 Comment(1)
A+ I also had a custom framework that had the same dependency as the app!Glenn
A
3

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.

Ariellearies answered 29/5, 2019 at 20:37 Comment(0)
O
3

For Unity3D

  1. Set "Always Embed Swift Standart Libraries" to YES for the Unity-iPhone target

  2. Delete Framework folder inside your .xcodearchive (see picture) path to archives ~/Library/Developer/Xcode/Archives

enter image description here

enter image description here from unity forum https://forum.unity.com/threads/2019-3-validation-on-upload-to-store-gives-unityframework-framework-contains-disallowed-file.751112/

Okinawa answered 6/5, 2022 at 13:9 Comment(0)
P
1

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.

Piton answered 29/9, 2019 at 21:3 Comment(0)
M
1

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:

Scheme script

Mudpack answered 16/4, 2021 at 14:58 Comment(0)
O
1

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

enter image description here

Okinawa answered 5/5, 2022 at 19:5 Comment(0)
B
0

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.

Brufsky answered 15/11, 2015 at 16:25 Comment(0)
W
0

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"
Woodhouse answered 14/11, 2018 at 0:18 Comment(0)
C
0

You should remove embedded frameworks from all pods and extension like in describe in: https://mcmap.net/q/129299/-error-itms-90451-quot-cfbundleidentifier-collision-error-quot

Classical answered 4/8, 2021 at 14:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.