How to debug "Invalid Bundle" error which happens only after submitting to app store
Asked Answered
L

13

50

I have a lot of frameworks in my app. App works fine in adhoc/enterprise release. Only if I submit to the app store for testflight testing I get this error email from apple:

Dear developer,

We have discovered one or more issues with your recent delivery for "My app's name here". To process your delivery, the following issues must be corrected:

Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.

Once these issues have been corrected, you can then redeliver the corrected binary.

Regards,

The App Store team

there is no specific information here. How can I debug it?

Lone answered 29/7, 2016 at 21:6 Comment(1)
L
42

Got an answer from Apple Developer Technical Support which says it is a bug on Apple's side. this is the suggested workaround below which did not work for me:

To diagnose this issue, you should export the IPA you are sending to the App Store from Xcode. Since IPAs are zip files, you can decompress it by right clicking and saying Open With > Archive Utility. You should find your main executable inside the unzipped folder structure and run otool at the command line to see the library list: otool -L

The list of paths you get should match what you find inside of your IPA. All of your libraries should start with @rpath. A simple comparison of everything in this list with the unzipped IPA folders should reveal what is missing.

Once you know what is missing, go to your Xcode build phases setup. There should be a build phase for either Copy Files or Embed Frameworks that includes the missing library — you should just add the library to the list. If you don’t see either of these build phases, you can recreate it by adding a new Copy Files build phase, setting the Destination to Frameworks, and adding the library to the list, ensuring that Code Sign On Copy is checked.

If you don’t find anything missing in your main binary, make sure to do the same search on any other binaries you may have, like for a watchOS app or an iOS app extension.

If you find that all of the frameworks are in this build phase, please take a look at the Embedded Binaries section of your app target’s General page, and let me know if you see multiple levels of ../ next to the binary that you found is missing.

Please let me know if it works for you!

Lone answered 1/8, 2016 at 20:17 Comment(1)
@Taha Selim Bebek Where do you find the ipa file?Chemisorption
S
15

I have encountered the same issue when uploading an app with watch support to the app store.

I was able to solve it with the hint from the first answer, using otool -L to analyze the binary from the ipa or xcarchive. However, the problem was not with my frameworks (at @rpath) but with a swift lib. I noticed that libswiftWatchKit.dylib was missing in the frameworks folder.

The solution that worked for me was as simple as to set EMBEDDED_CONTENT_CONTAINS_SWIFT=YES in the build settings of the watch app (or the watch app extension, but not both). After that, all necessary swift libraries were correctly copied to the watch app path in the archive and upload to app store was working correctly.

Apparently, the watch app works and upload passes if you provide the necessary swift libraries only in the main app's folder.

Successful answered 13/9, 2016 at 19:33 Comment(2)
I have the same issue, but setting EMBEDDED_CONTENT_CONTAINS_SWIFT did nothing for me. I posted here: #39481674Leandro
In XCode 8 it has changed to ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIESMortician
B
14

After adding the custom Swift framework to my project I got this email after uploading the app to iTunes connect.

I got this email from iTunes store,

Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.

The fix is simple for this issue,

Step 1: Make sure your Custom framework is added to Embedded Binaries in General tab of your target. enter image description here

Step 2: Under build settings,

Set Always Embed Swift Standard Libraries = Yes for your main project target.

And Set Always Embed Swift Standard Libraries = No for your custom framework target.

This solved my problem and I was able to upload binary to iTunes connect.

Ref

Boxboard answered 25/8, 2017 at 10:26 Comment(5)
This answer is the right one to get on track. In my case, ALL of my cocoa pods I had to link them in Linked Frameworks (BUT YOU CANNOT PUT COCOAPODS IN EMBEDDED BINARY). But you CAN put your own apps custom framework in embedded binaries, however for me that has not been necessary when submitting to the app store.Blab
Isn't it wrong to manually link to a debug version of the framework for a release binary?Tutuila
@Tutuila This is for demo purpose only. All best practices must be followed.Boxboard
Ok @ZaidPathan but how do you link the correct targeted framework depending on your build configuration?Tutuila
From docs: "Add the framework target to the Embedded Binaries section by clicking the Add icon, highlighted in Figure 5. Do not drag in the framework from Finder." Possible Explanation Often when you drag, Xcode uses an absolute path to the framework. That absolute path is specific to the specific config/build. You don’t want it to be specific to the build/config. Instead you want it to be specific to just the app target and its relation to framework — void of any config/pathGoofball
C
8

Tried all the above solutions and did not work for me.

I was experiencing this issue in Xcode 10.1 recently and all my frameworks were referenced correctly (did otool -L and everything lined up).

Seems there were some changes in the apple validation process, may be a bug, may not be on Apple's end, but all my prior builds uploaded and validated fine -- and I did not add any new frameworks since.

Upon uploading the binary to iTunesConnect, I'd see the following error:

Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.

Invalid Bundle - The app uses Swift, but one of the binaries could not link to it because it wasn't found. Check that the app bundles correctly embed Swift standard libraries using the "Always Embed Swift Standard Libraries" build setting, and that each binary which uses Swift has correct search paths to the embedded Swift standard libraries using the "Runpath Search Paths" build setting.

MY SOLUTION:

  • After days of debugging, what worked for me was to disable 'Include bitcode for iOS content' upon uploading the archive from Xcode organizer. Seems that this option modifies the binary which caused the validator to fail.

enter image description here

  • Or you can disable bitcode in your Build Settings
Confine answered 4/3, 2019 at 20:16 Comment(2)
This is not a solution but rather a workaround which is far from great. Omitting bitcode will increase the overall app size.Muffle
When bitcode disabled Firebase Crashlytics will not workCotquean
P
2

My Problem: I had the same error with embedded frameworks.

  1. The App project has Custom Framework project
  2. Inside the Custom Framework project is another Custom Framework project

The app built to the simulator and to devices with no problem but failed the Apple test, returning "Invalid Bundle".

I inspected the package just like Taha had been told to by Tech Support and everything was present and correct!

My Solution: I restructured the project so that the two custom frameworks sit side by side and one is no longer embedded within the other.

This looks to be an Apple validation problem since everything works fine on devices and the simulator but the work around was straight forward.

Philbrook answered 16/9, 2016 at 8:42 Comment(1)
Perfect! I had a framework inside a framework. I think it's because of that CocoaPods doesn't allow pods inside a framework.Stipulate
W
2

In my case, in the build settings, this was fixed when I added the following to the build settings for the library:

 DYLIB_INSTALL_NAME_BASE = @rpath

The clue was a linker warning: 'YourLibrary has an install name beginning with “/”, but it is not from the specified SDK'

Williamson answered 2/4, 2017 at 15:10 Comment(0)
G
2

Had same issue. This happened to me because one of my Framework target was added to main target in "Link Binary With Libraries" but was not added to "Target Dependencies" and "Embedded Binaries"

Garner answered 20/9, 2018 at 12:54 Comment(1)
This helped me. My project internal frameworks were not added to "Embed Frameworks" under Build Phases in main target.Preferential
F
2

I also received a similar mail from Apple:

Dear Developer,

We identified one or more issues with a recent delivery for your app, "********. Please correct the following issues, then upload again.

ITMS-90562: Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.

Best regards,

The App Store Team

I used my own framework for my watch app. I solved this issue by changing the framework option to "Embed Without Signing" in the Extension Target. The default option was "Do Not Embed".

enter image description here

Featureless answered 26/9, 2019 at 12:28 Comment(0)
M
1

I had the same problem, it was due to one framework not being present in the Frameworks subfolder in the app bundle.

I fixed it by adding a Copy Fields build phase, and adding the missing .framework file there.

Meares answered 25/9, 2017 at 16:15 Comment(0)
C
1

This error message is also addressed in Apple Technical Note TN2435 Embedding Frameworks In An App: https://developer.apple.com/library/archive/technotes/tn2435/_index.html

You can find the error message under the heading "Missing Framework Bundle" with troubleshooting steps.

Copland answered 11/10, 2018 at 15:26 Comment(0)
S
1

We had the same problem, and even after going through all the steps (see "Missing Framework Bundle"), the only thing that worked was disabling Bitcode.

Spellbinder answered 24/10, 2018 at 20:50 Comment(1)
Seriously? I've intentionally turned bitcode on precisely because we want to upload a bitcode version...Scent
D
0

So I struggled on this for two days. What it turned out to be was I had UITests checked in Archive for the Build for the Scheme I was archiving.

After unchecking it from Archive, re-archiving it, validating it (although validating it before always passed), and "Upload to AppStore" I did not get the e-mail from Apple informing me of Invalid Swift Support. Instead I got the e-mail that it'd been processed and is good to go!

Dunlin answered 13/10, 2017 at 14:58 Comment(0)
P
0

In my case, I've had to add a framework from Notification App Extension to the main target (embed & sign in the main target, do not embed in the extension) - even though there was no mention about it in otool -L output.

Funny thing that Iterable official doc says that the framework should be embedded & signed in the extension - which would lead to another upload problem because of nested bundles. enter image description here

Pandich answered 29/9, 2021 at 7:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.