200

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

pkamb
  • 33,281
  • 23
  • 160
  • 191
Mike
  • 6,285
  • 4
  • 18
  • 22

22 Answers22

367

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
pronebird
  • 12,068
  • 5
  • 54
  • 82
Mike
  • 6,285
  • 4
  • 18
  • 22
  • 7
    You are my savior. "Embedded" means extension in bundle, and since an extension does not contain more extensions, it does not contain swift code. – Chris Truman Sep 26 '14 at 19:36
  • 3
    This didn't resolve the issue for me. I'm also using CocoaPods. Has anyone seen issues relating to that? Any other ideas? – timschmitz Apr 03 '15 at 04:58
  • 8
    Don't forget with WatchKit extensions to make sure that the Runpath Search Path has `@executable_path/../../Frameworks` – Mr Rogers Apr 07 '15 at 20:31
  • 1
    @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. – Beau Nouvelle Apr 16 '15 at 02:10
  • This is really unnecessarily confusing, and it's all due to the inept phrasing of the setting text. – Rich Tolley Sep 28 '15 at 09:44
  • This also works for embedded framework targets used in other apps. – leogdion Apr 18 '16 at 18:37
  • 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. – sumizome May 04 '16 at 21:29
  • there is no such settings for watch app extension – Injectios Oct 14 '16 at 15:06
  • 1
    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!! – A. Trejo Dec 13 '16 at 01:22
  • I have pods. What is the config for the pods? Always Embed Swift to Yes or to No?? – Alfro Feb 09 '17 at 14:50
  • 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 extension – Satheeshkumar Naidu Jun 21 '18 at 09:46
  • I just had to do the part for the extension, the original app also has "NO" set there. It's fully working. – Nat Sep 06 '18 at 22:54
  • 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. – Steven Craft Aug 13 '20 at 09:25
  • 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). – Adam Howard Aug 16 '21 at 04:34
  • 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. – Oleg991 Feb 08 '22 at 08:29
  • 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: NO – Jim Kniest Jun 09 '22 at 23:20
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

johnnieb
  • 3,982
  • 4
  • 29
  • 32
Roman
  • 1,920
  • 2
  • 17
  • 17
  • 7
    My app does not use Swift so this was the only fix that worked for me too. – Dan Loughney Oct 29 '15 at 02:43
  • Same - No Swift in my app, and this fix worked for me. – Jai Nov 04 '15 at 06:03
  • I had to add this script to both app extension and watch extension – Slyv Nov 25 '15 at 10:22
  • This is the only fix that worked for me. No Swift code being used anywhere – Anuj Rajput Dec 11 '15 at 04:36
  • The script worked for me as well. Seems to be a known issue with Cocoapods. – duncanc4 Dec 15 '15 at 23:00
  • Worked for me (Xcode 7.2, app with Today widget and watch extension). Thanks – Macistador Jan 01 '16 at 02:57
  • 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? – Raphaël Pinto Jan 21 '16 at 13:59
  • 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 fi –  Apr 06 '16 at 06:41
  • No swift in my code and that's the only thing that helped me. – Idan Apr 20 '16 at 16:06
  • I had to do this AND set `Embedded Content Contains Swift Code: NO` on the Today Extension in order to get it uploaded successfully. – sumizome May 04 '16 at 21:27
  • 8
    Worth mentioning that this only needs to be added to the extension, not the main target. – theDuncs Aug 04 '16 at 12:04
  • its really helpful answer. I get same issue and just adding that run script in my notification extension that works for uploading. + for you – Nitin Gohel Mar 16 '17 at 14:44
  • 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. – NSDestr0yer May 13 '17 at 18:01
  • 4
    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? – Subkhan Sarif Aug 11 '17 at 03:51
  • 8
    Is it just me or is this kind of insane? – bkbeachlabs Apr 06 '18 at 20:57
  • 2
    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 – Aleem Oct 30 '18 at 12:00
  • 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. – Kendall Helmstetter Gelner Oct 16 '19 at 21:34
  • Worked while using flutter plugins. – Adolf Dsilva Dec 18 '19 at 03:22
  • 1
    You will probably want to copy all the frameworks first to the ipa root frameworks folder before removing the nested framework folder. – João Zão Feb 24 '21 at 12:25
  • 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. – Oleg991 Feb 08 '22 at 08:29
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
RawMean
  • 8,374
  • 6
  • 55
  • 82
Vincent Song
  • 632
  • 6
  • 9
  • 3
    Container vs Extension, I am new to Xcode. where is that, are extension cocoa pods? or where are these two things located? – Serge Pedroza Sep 19 '15 at 18:32
  • 2
    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 – Daniel Gomez Rico Jul 31 '20 at 02:34
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

Dan Loughney
  • 4,647
  • 3
  • 25
  • 40
  • 7
    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. – fguchelaar Jul 14 '16 at 13:10
  • 2
    Upgrading Cocoapods to `1.1.0.rc.2` solved the problem for me. – Otávio Oct 10 '16 at 17:00
  • 1
    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! – Storm Factory Oct 11 '16 at 00:24
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

suztomo
  • 5,114
  • 2
  • 20
  • 21
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.
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
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.

Max MacLeod
  • 26,115
  • 13
  • 104
  • 132
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.)

Pim
  • 2,128
  • 18
  • 30
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.

Community
  • 1
  • 1
Reeonce Zeng
  • 392
  • 4
  • 14
  • you're amazing @Reeonce Zeng, save my day! – MGY Mar 10 '16 at 08:58
  • 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 –  Apr 06 '16 at 06:37
  • @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 ` – Reeonce Zeng Apr 06 '16 at 07:11
  • 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 ? –  Apr 06 '16 at 07:19
  • 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. –  Apr 06 '16 at 07:43
  • @stack, that is why you need to add a new run script phase, just find the "+" symbol, and click on that!!! – Reeonce Zeng Apr 06 '16 at 07:49
  • ha ha, Now say, from which tab i have to choose ? "Embed pods framework" or "copy pods framework" ? :P –  Apr 06 '16 at 07:55
  • This worked for me as well! Don't forget to check order of Run scripts for all targets (WatchKit, Today widget). – Almas Adilbek Jun 24 '16 at 04:01
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.

Kudit
  • 4,212
  • 2
  • 26
  • 32
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.

Narasimha Nallamsetty
  • 1,215
  • 14
  • 16
  • Thanks! This solved it for me. This solution ensures that a framework is only included once in the app bundle. – DCDC Nov 20 '20 at 15:40
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.

Kurt J
  • 2,558
  • 24
  • 17
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 )
Yongxiang Ruan
  • 189
  • 1
  • 3
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.

Zatman
  • 144
  • 2
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/

2

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.

Travis M.
  • 10,930
  • 1
  • 56
  • 72
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.

Belle B. Cooper
  • 375
  • 5
  • 13
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

Juan Sagasti
  • 326
  • 2
  • 5
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.

andreacipriani
  • 2,519
  • 26
  • 23
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"
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Frank
  • 399
  • 4
  • 16
0

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

Moran77
  • 119
  • 8
0

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