Xcode - Bundle format unrecognized, invalid, or unsuitable - ios

Ok so I have just about managed to get to this point on my own but am now having some issues code signing the app specifically with the AdMob framework. I am getting this error:
Command /usr/bin/codesign failed with exit code 1 the details it are giving are as follows: Applications/MyApp.app/Frameworks/GoogleMobileAds.framework: bundle format unrecognized, invalid, or unsuitable
I have read the other posts on the site and tried many different ways of fixing this. If I untick 'Code Sign On Copy' the archive builds successfully but then fails on validation with a match error. This is how I have my frameworks set up currently:
Any help would be much appreciated!

I saw this same issue with a different framework.
The solution for me was removing the framework from the 'Embedded Binaries' section and only adding it to the 'Linked Frameworks and Libraries' section in the target 'General' tab.

I have just seen the same issue but with a different framework that was the social framework and then I did below:
go to build phase -> embed frameworks -> press copy only when installing check box
then it worked with me with no error

I had a similar problem but with a different framework. The solution for me was to make sure that the framework was present in these three places:
General tab:
Embedded Binaries
Linked Frameworks and Libraries
Build Phases tab:
Embed Frameworks

I ran into this issue when using a different framework.
Clear the DerivedData solve this issue.
https://docs.sentiance.com/sdk/troubleshooting/ios/bundle-format-unrecognized-invalid-or-unsuitable
Go to Xcode menu bar and select File > Project Settings (or Workspace Settings).
Under Per-User Workspace Settings, find the shortcut to DerivedData folder and open it via Finder.
Remove the entire content of the folder and empty the Trash.
Restart Xcode.

In Xcode 11.*
Target -> General -> Linked Frameworks and Libraries
change related framework with option "Do Not Embed"
Else Check on the :
Target -> Build Phase -> Link Binary With Libraries
Check status with Required/Optional - try it with required first.

Related

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

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?
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!
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.
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.
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
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.
Or you can disable bitcode in your Build Settings
My Problem:
I had the same error with embedded frameworks.
The App project has Custom Framework project
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.
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'
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"
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".
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.
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.
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.
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!
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.

Unable to run app in Simulator: An error was encountered while running (Domain = LaunchServicesError, Code = 0)

After successfully compiling the project in Xcode 6, I am unable to run it in the simulator with the above mentioned message. I did all the possible research, tried everything and still no advances.
I am not working with swift, neither I use widgets or extensions, so please do not suggest solutions caused by these as can be seen in similar questions.
If someone found a possible cause (or solution!!) other than these, please help. Thanks
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
Cleaning the build folder resolved the issue for me.
(While holding down the Alt-key: Product > Clean build folder)
I tried every other solution listed here. Well, I ported my project from Swift 1.2 to Swift 2.0. The application was stuck even after a lot debugging and launch services error 0 was reported.
solution: It happens because of framework compilation.
App target -> Build Phases -> Embed Frameworks.
So mark copy only when installing on. Clean the project and run it!
This has now been resolved. The problem was caused by ShareKit library added by CocoaPods for compatibility reasons. After removing the library and all related code, the app successfully launched in simulator. I recommend checking the system log for more details on the issue as to me it pointed me in the right direction (stating the name of conflicting library).
In case anyone has this problem in combination with cocoa pods, these steps helped me to solve this error (after few hours):
run pod cache clean
from SRC_ROOT run rm -rf Pods (optionally rm Podfile.lock)
Click on the Simulator app, click Simulator -> Reset Content and Settings...
Go into Xcode, In the Menu bar click Product -> Clean (or click Shift + Command + K).This will to clean your Xcode project.
Create a new Terminal Shell (From menu bar click Shell -> New Window)
run rm -rf ~/Library/Developer/Xcode/DerivedData/
...then try to Build & Run your project.
Note:
SRC_ROOT can be found by entering the Navigator, clicking on the project, clicking on the project again from the project and targets list, going into Build Settings, scrolling all the way to the bottom to the User-Defined Section, and the SRC_ROOT will be labeled as PODS_ROOT. Take that and copy it verbatum into the Terminal and proceed with step 2 from the list above.
Hope it helps.
I get rid from the issue by the given steps for simulator
1. Way
Reset Content and Settings of Simulator.
Clean your project by Cmd+Shift+K.
Clear your Derived Data.
The last one which is more important change your Bundle Identifier by "com.yourcompanyname.projectname" like "com.facebook.Facebook"
2. Way
You can do only be the given line, it works for me
The last one which is more important change your Bundle Identifier by "com.yourcompanyname.projectname" like "com.facebook.Facebook"
Thanks and enjoy programming.
Might be related to this issue: "This app contains an app extension with an illegal bundle identifier" issue
I had to format the bundle identifiers for my app and extension as follows:
com.company.AppName
com.company.AppName.Extension
First "Reset Content and Settings"
If you didn't fill the build number and fill it and Run.
It's solved for me.
If you change the name of the supplied class InterfaceController set by default when you start a new project. This class is referenced in the Info.plist under the key RemoteInterfacePrincipalClass. In my case, I got the error mentioned by the OP until I fixed the name of the class in there (see screenshot).
If you are here after having issues doing an integration with WatchOS 2.0, go to - ~/Library/Logs/CoreSimulator/[Device UDID]/system.log and if says something like WatchKit 2 app has frameworks; that's not allowed. then follow the link below.
http://zyafa.me/blog/watchos-2-and-embedded-frameworks
Thanks for pointing this out #Miki and kudos to you. I had the same issue as you yesterday (and I added ShareKit 3.0.0 from CocoaPods to the app a few days ago). I suspected ShareKit giving me this problem, but now I can be confident of exactly which library is causing this. Here is what I found in my log (if it can benefit others):
Error Domain=LaunchServicesError Code=0 "The operation couldn’t be
completed. (LaunchServicesError error 0.)" UserInfo=0x7fa836097aa0
{Error=PackageInspectionFailed, ErrorDescription=Failed to load
Info.plist from bundle at path
/Users/{UserName}/Library/Developer/CoreSimulator/Devices/99FEB34E-6F00-4EFA-861A-A6985AFE96D8/data/Library/Caches/com.apple.mobile.installd.staging/temp.X7eead/extracted/{AppName}.app/Frameworks/LiveSDK.framework}
I'm adMob user and I solved enabling "Copy only when installing" in App target -> Build Phases -> Embed Frameworks.
Have the same problem after localizing my app. Especially Info.plist. Seems I had empty CFBundleShortVersionString in InfoPlist.strings, after fixing that the simulator started to work properly.
I got this issue by adding a folder reference named "Resources".
If I give it another name, then it runs !
There are a number of things that can cause this error. The best general answer is to search the console log for CoreSimulator, as the simulator logs the underlying problem when it displays this message.
If you have installed any libraries using CocoaPods while XCode was open, all you have to do is, Close XCode and remove the library from Pod file, run the command pod install it will uninstall that library. then install library again. Please make sure that XCode is always closed while installing and uninstalling libraries.
I hade exactly the same problem and it was ShareKit.
On the simulator I had "Error Domain=LaunchServicesError Code=0".
On the iPhone6 device I had "App installation failed Could not inspect the application package."
When I removed ShareKit it worked.
I had this problem when I added an Apple Watch target to my app, and accidentally removed the InterfaceController.m file. Adding back the file in the target fixed the problem.
There are different things that can cause this. Looking in the console may well give you a clue.
In my case - the issue was an extension built before I changed the name of the product. Xcode didn't clear the old one out, then got stressed at two extensions with the same bundle id.
(Deleting the build folder fixed my particular issue).
In my case the issue came from an icon set added with some images missing. Once I replaced the icon set with another one, and uninstalled the app in the simulator; I was able to run it again.
I removed all my pod files and replaced them all, seems the problem for me was the bolts framework was old, and causing this error. I did a clean & reset content and now it's all good.
Do not add the google maps framework to the embedded lib section this solved my build break.
I had this error in developing app for Apple Watch after adding in Info.plist: "App Transport Security Settings" and "Allow Arbitry Loads" = YES. (In WatchKit App, in WatchKit Extension is good!!)
Deleting this two rows, it keeps working.
For me, the problem occurs because I added my framework (GoogleMobileAds.framework in my case) to Embedded Binaries, not Linked Frameworks and Libraries.
For your information, AdMob instructs you to use Add Files to "Your Project" menu on Xcode, but I was too lazy to obey the instruction.
I had this problem when trying to run UI tests in a project containing AWS Cognito.
Here's how I resolved it.
Select the UI test target.
Click on the Build Phases section.
Click the plus to add a Copy Files phase
In the Copy Files phase, change the destination to Frameworks (see the last image)
Hit the plus below the Copy Files phase.
Select the framework for which you're receiving an error and hit the Add button (yours will probably not be the first item in your project hierarchy).
It should end up looking like this.
Repeat steps 5 and 6 for all frameworks giving you an error.
Run your tests.

dyld: Library not loaded: #rpath/libswiftCore.dylib / Image not found

I am running my app from xcode to my iOS device and I get this and black screen on iOS device.
Console text:
dyld: Library not loaded: #rpath/libswiftCore.dylib
Referenced from: /private/var/mobile/Containers/Bundle/Application/10DB2FE8-EF09-4857-B4AC-0DB2E4419D6F/App-Name.app/App-Name
Reason: image not found
(lldb)
Try adding the following line to Runpath Search Paths of your target.
#executable_path/Frameworks
your_target -> Build Settings -> Linking -> Runpath Search Paths
I had this same issue. I ended up adding the framework in the following locations:
General > Embedded Binaries
General > Linked Frameworks and Libraries
Build Phases > Link Binaries with Libraries
The embedded binaries seemed to be the key for me.
For me helps adding #executable_path/Frameworks to the project Runpath Search Paths, not target.
your_project -> Build Settings -> Linking -> Runpath Search Paths
None of the other solutions helped me, but everything was fixed by deleting Xcode's Derived Data directory.
Oh yes. I've faced with that problem spending hours on solution.
You may try to set "Always Embed Swift Standard Libraries" to "Yes" under your Build Settings > Build Options
(don't forget to shift+cmd+K your project after)
I had to switch 'Embedded Content Contains Swift Code' to 'Yes' to get my Obj-C app to work after updating the Obj-C embedded framework with a Swift object.
In the Framework Target (not the app target), go to Build Settings > Build Options > Always Embed Standard Swift Libraries to YES.
This solved the issue for me!
I had this error in a command line project (Xcode 10.2 and macOS 10.14.3)
The solution was to update to macOS 10.14.4
Swift command line projects won’t run on macOS 10.14.3 and earlier unless you install the Swift 5 Runtime Support for Command Line Tools package. Without that package, Swift command line projects crash on launch with “dyld: Library not loaded” errors. (46824656)
From Swift 5 Release Notes for Xcode 10.2
In my case, This issue is coming in Objective-c project in which I am using a Swift framework (AirWatch SDK).
Solutions:
I have resolved this issue with Xcode 9.3 and 11.0.1 iOS as mentioned bellow steps :
Drag and drop your swift framework in your project and move in default Framework folder of your project.
Then add them as Embedded binaries as shown in screenshot.
Change your framework status from Required to Optional as shown in screenshot. (Build Phases > Link Binary with Library)
Set Always Embed Swift Standard Libraries to Yes in your build settings.
Set Subpath and select destination as Framework for your added framework in Build Phases> Embed frameworks
as shown in screenshot.
Hope it will help someone.
I have faced the same issue, setting the right code sign identity solved the problem(Build settings->Code Signing Identity).
As per Apple technical questions "All Enterprise and standard iOS developer certificates that are created after iOS 8 was released have the new Team ID field in the proper place to allow Swift language apps to run"
I fixed by deleting all from Xcode Derived Data directory:
~/Library/Developer/Xcode/DerivedData
Good luck all!
This error message can also occur when using a framework build in a different Swift version then the one currently being used, e.g. if you upgrade Xcode.
I had the same error message, that is how I solved it :
The issue came from the certificates generated automatically by Xcode. I had to revoke these certificates dans generate them back from developer.apple.com
The solution is then :
- Go to developer.apple.com / certificates --> Revoke certificates
OR go in Xcode > preferences > accounts > View details > select Sigining identities > clic setting whell > revoke
- Got to developper.apple.com and follow instructions to generate new certificates
- In Xcode in my project : go to Code Signing Identity and sign both Debug lines with the generated certificate
- Both release lines are set to "iOS Developer"
- Then project > clean
- Build and run on device
#Saikiran's answered worked.
My certificates were generated before iOS 8 was released. I revoked all my certificates and regenerated all provisioning profiles and it solved my problems immediately.
I don't have enough reputation to vote up #Saikiran's answer, but that definitely helped solving the problem.
For me has worked set the option
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES
to YES in Project -> Build Settings -> Build Options
(Namirial framework through Cocoapods)
None of the above solutions worked for me. I changed the iPhone Developer Certificate trust settings in Keychain. It should be Always Trust. Change it to Use System Defaults. Double click the certificate in Keychain to open the option screen
Discovered that from this blog
I had the same error message, this is how I solved it :
This is happening because i changed bundle identifier, so i just put old bundle id and it started to work again
I already had the Runpath Search Paths set correctly, but it still didn't work. #Justin Domnitz's answer put me on the right track: Setting "Always Embed Swift Standard Libraries" to Yes in my target's build settings did the trick for me.
Seems this issue was caused by the inclusion of Swift file into objective-c custom framework. Also unsure if related but my app target was built in objective-c as well. Also building to simulator in debug. Haven't verified for release or archive build yet.
Additionally Runpath Search Settings for the project target were set to "#executable_path/Frameworks", within the target settings for the framework they were set to: "#executable_path/Frameworks" and "#loader_path/Frameworks".
After having tried rebuilding custom framework and reattaching to app target, clearing derived data folder and a couple other suggestions, what ultimately worked for me was changing the build setting within Project target for the custom framework project (not app target): "Always Embed Swift Standard Libraries" to "YES". It appeared not to matter what the setting for the app target was set to. I verified this by resetting the simulator and rebuilding. This is similar to Daniele Ceglia's answer but I wasn't able to add a comment and wanted to provide more clarity.
For me Cleaning the project solve the issue!
I got such issue, too
All other ways could not help me,
so I have done it on stupid way
created new project and pod install from scratch
and after confirmed it is working correctly, I copied all class files and storyboard files, at last done!
I think it is the last way for it, maybe could help you
I had a similar problem in an Objective-C project where I started to include Swift files.
In my case, I created two targets in the main project, and I added a Swift empty file, that creates a bridging header file and some configurations, but I only marked it as a member of one target. The first target works properly, but the second not, and I noticed that the differences in build settings were this setting:
Runpath Search Paths -> $(inherited) and #executable_path/Frameworks
And I also needed to reference Objective-C Bridging Header to the file that was created before:
Objective-C Bridging Header -> pathTo/Target-Bridging-Header.h
After adding this two settings, the second target started to work properly.
Try cleaning the build folder, I was having the same problem and I solved it this way:
Product -> Clean Build Folder
For Me restart simulator solved this problem.
I tried a bunch of the cases above and it didn't seem to solve my issue. I use git and cocoapods for a project, and the error went away as soon as I made a new commit.
I had this problem before in iPod touch iOS 9.3. And I used all the methods mentioned in this post, but none of them worked.
I checked my project setting. And in the other link flag, I found I added -Wl,-sectcreate,__RESTRICT,__restrict,/dev/null.
This flag prevents dyld insert in the jailbroken phone. When I delete this flag, the app can be launched again. I am not sure why it worked. Because in iPhone se iOS 10 I don't have to delete this line. But it did work in iPod touch iOS 9.3. So check it if you have the same situation like me.
Please check the *.framework If there is a _CodeSignature signature framework directory.
If there is no _CodeSignature folder,
Navigate to the Build Phases ,click + to add New Copy File Phase to create Copy Files.
after that, reference *.framework and choose Code Sign On Copy

Appstore FailureNo architectures in the binary. Lipo failed to detect any architectures in the bundle executable.” At SoftwareAssets/SoftwareAsset

Hi I just tried to upload my app to the app store but it failed with error.
**
No architectures in the binary. Lipo failed to detect any
architectures in the bundle executable.
**
That can also happen when the Cocoapods cache is not in sync, then just
pod install
solves the issue.
Hi I'm glad i found the Answer. The problem was actually with my 'Productname' in info.plist . It was different in my first version.
Same thing. Had this issue. I just changed
Project -> Build Settings -> Produc Name (wrote: "Wundmanager")
then
Project -> General -> Identity -> Bundle Identifier (wrote "imeksbank.Wundmanager")
my nick is imeksbank
and then
iTunes Connect and the same to Bundle-ID (chnaged "imeksbank.Wundmanager")
After that it worked for me. I am also new and today is my first day i can Upload my first App.
xcode 5.1.1
ios 7.1
Can also be caused by embedding a static framework (mistaking it for a dynamic one) in your app. Easily done if you build in different phases and/or allow xcode to "build implicit dependencies".
After a long struggle with an error message like this, I finally understood that mistakenly an iOS framework had been copied into the IPA. This was added automatically following the usual steps to add a framework to an iOS project.
So the solution would be to remove "Embed Frameworks" phase from "Build Phases".
I was able to get past this error by restarting Xcode.
Sometimes cleaning your project quitting and re archiving will solve the issue. In my case it worked. I don't have any issues with the bundle name, identifier or plist.

Cannot find ScriptingBridge.framework

I am new to objective-C.
I have programmed my first App in the last 2 months. I am now trying to access iTunes information and the coding appears to be straight forward but I cannot locate the ScriptingBridge.framework.
I am using Xcode 4.5. I have tried using the "+" button in the Link Binaries with Libraries section of Build Phases but ScriptingBridge.framework does not appear on the list. I have tried opening the framework directory in Finder with no luck. I cannot find a way to download the file independently from installing Xcode.
I have tried uninstalling and reinstalling Xcode. Any suggestions?
Thanks,
BobT
ScriptingBridge.framework is not available for Cocoa Touch.
I don't think you can use the scriptingBridge framework with an iOS Project. You only can use it with a cocoa application project. In a cocoa application project you can add the framework under
Targets -> Build Phases -> Link Binary with Libraries -> +
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/UsingScriptingBridge/UsingScriptingBridge.html

Resources