15

I'm having the same issue as this guy, this guy, and this guy (nota bene, I'm actually not sure if they're all guys, per se).

They all ended up finding their own solutions, but none of them apply to my issue. I'm using Xcode 6.1 in my iOS 8 app with an included extension. The app and the extension both rely on an included framework. When I try to submit the app to the Store, the validation warning I get is "ERROR ITMS-9000: Invalid bundle. The bundle at 'xxxxx.appex' contains disallowed file 'Frameworks'".

I can't even find a file called Frameworks. The shared framework is supposed to be saved at /Library/Frameworks, which is Apple's recommended save location. The project also uses Cocoapods, which strikes me as the only other possible culprit, since it has references in its configuration files to $FRAMEWORK_PATH (though the build folder doesn't include a file or folder with that name).

Community
  • 1
  • 1
Aaron Vegh
  • 5,217
  • 7
  • 48
  • 75

4 Answers4

10

OK for future viewers here's the fix:

When you create your own iOS framework (I'm using Xcode 6.1) when you build it the final product contains a 'Frameworks' folder in the framework bundle itself. i.e. MyFramework.framework/Frameworks. This happens even if you don't specify a copy files/embed frameworks build phase.

What you have to do is to go into you framework bundle, find the empty frameworks folder and delete it. This should not affect your app's functionality in any way. Then build your app and check that the embedded framework doesn't have a Frameworks folder as planned.

Your archive should now not contain the offending folder and the error should be gone!

Rob Sanders
  • 5,197
  • 3
  • 31
  • 58
  • How do you "go into you framework bundle, find the empty frameworks folder and delete it"? Where is the framework bundle? and how to open it? – WayneZhao May 19 '15 at 04:05
  • The frameworks folder is wherever you put it. When you build it it appears in the `Users/username/Library/Developer/Xcode/DerivedData/projectName/Build/Products/Debug-xxx/`. I then move them about so that Xcode can recognise they exist. If you double click on the `myFramework.framework` file (it's like a folder) you will then see a Frameworks folder that needs to be deleted. – Rob Sanders May 19 '15 at 20:19
  • Worked for me but i have to figure out how to not have carthage build frameworks containing frameworks... – Jeef Sep 17 '15 at 23:54
4

I changed build settings > Packaging > Define modules set to YES in my extension and watch app target. Works fine for me.

David T.
  • 90
  • 1
  • 6
  • Xcode 7 user here, this worked for me after this kind of issue resurfaced for reasons the old answers didn't account for – CQM Sep 22 '15 at 19:16
4

In my case the solution was the following :

Try to create the script there 'problematic target' -> Build Phases' then click on + and select New Run Script Phase, the run script should go after all others. Insert there :

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

Then clean the project and try to create an archive once again. These answer was provided in the following issue :

I hope this help you.

Victor Sigler
  • 23,243
  • 14
  • 88
  • 105
  • In my case, with XCode 7.1.1 the script doesn't fix the problem. So I had to downgrade cocoapods to version 0.39.0.beta.3 and then run command "pod install" – andreacipriani Nov 16 '15 at 09:06
  • 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:42
  • I have just disabled the Cocoapods Framework embed script, same frameworks are in the main app anyway. – igraczech Apr 19 '16 at 13:22
  • 1
    Why the downvote on this answer? It is a solution that works. – buildsucceeded May 17 '16 at 09:07
  • 1
    @buildsucceeded I think one day SO allow to explain every time somebody make downvote why he/she is downvoting and some moderator can allow it or not. – Victor Sigler May 18 '16 at 12:53
  • 1
    This hides the problem, yeah, it'll remove the Framework folder so it won't complain about the bad Framework folder but now you won't have your Frameworks! – Downgoat Apr 04 '17 at 01:11
2

Continuing to work with this, I noted that my Share Extension had an "Embed Frameworks" Build Phase, with the Destination set to the "Frameworks" directory. I changed it to "Shared Frameworks" and the error has gone away.

However, another error remains: "... contains disallowed nested bundles". I thought this was a sort of umbrella error warning as a result of the original. I'll open another question for that one.

Aaron Vegh
  • 5,217
  • 7
  • 48
  • 75