Executable not found - But app building Xcode - xcode

I would like to put back on TestFlight a swift code for a client who got abandoned by his developers.
It's a photo app that is used to make mesures and relies on OpenCV to do so. After adding locally to the main directory the opencv2.framework for iOS apps. The code builds correctly (with some warning for libraries but no errors). But even if the directory exists and the .app executable file exists I obtain an "Executable Not Found" message at the end of the build and the app does not run on the emulator.
I already checked those articles:
https://developer.apple.com/library/archive/technotes/tn2215/_index.html
https://developer.apple.com/documentation/technotes/tn3110-resolving-generic-xcode-archive-issue
https://developer.apple.com/documentation/technotes/tn3109-resolving-common-archiving-issues
The main issue remains that the code is archived as a "Generic Xcode archive" and hence the build cannot be published to the App Store or TestFlight.
Here are some pictures to understand the problem:
Do not hesitate to throw some idea!

Related

iTunes Connect - Invalid Bundle -> Bitcode Issue

I have a problem with my build becoming invalid in iTunes Connect. I have a workspace consisting of app project, library project and cocoa pods project in it. My cocoa pods has only KeychainSwift and GoogleMaps in it.
From iTunes Connect I get the reason described as
Invalid Bundle - This app includes files that were built with bitcode enabled but without doing an Archive or Install build, possibly from a library or framework that was imported but not built as part of the project. Full bitcode content is only generated in an Archive or Install build.
I have bit code enabled in settings and also do Product->Archive but it somehow does not work. Am I doing something wrong is it because of the libraries? Is there a way to find out which one is the problem?
After a couple of different things I tried one seems to be the solution for my problem: The location of my own library copied to the app project needs to be Location: "Relative to Group" (not "Absolute Path"). Now it was accepted by iTunes Connect.

iOS error "Embedded binary is not signed with the same certificate as the parent app"

Those are my first steps in IOS applications development and I'm facing some problem that I can't figure out.
error: Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target's code sign settings match the parent app's.
Embedded Binary Signing Certificate: Not Code Signed
Parent App Signing Certificate: iPhone Developer: Emil Adz (9QNEF95395)
I can't understand, what is a Embedded Binary Signing Certificate?
I went over the questions with the same error here, but none of them were related to the problem presented here (Not Code Signed).
I tried to revoke my certificate from the Apple Developer Member Center and request another certificate, but the issue persists.
Does some know how it could be fixed?
Swift 5 . Simple way in my case check this screen shot i am done
The embedded binary is referring to a widget that you are deploying alongside with your app.
In your case, you are not signing your widget with any Signing Identity (since your error says "Not Code Signed").
To resolve this, go to your Project file, find your widget's target, and under the Build Setting tab, find the Code Signing Identity value. Choose the same code signing identity that you are using for your main app's target.
You will also need to create and configure a provisioning profile specifically for your widget when you want to release it.
Sometimes none of the solution on Stackoverflow works. In that case,
Solution
Make sure that there is no red mark/issue in any of the sections of Signing(Debug), Signing(Release) and Enabled capabilities in both of MainApp and EmbeddedApp
Make sure that both certificates and provisioning profiles are installed under login/system keychain.
Make sure that your certificate is never ever set as Always Trust. Access must be kept as Use System Default
This error is also shown when deployment target of your Today extension is newer than the parent app. They must be the same.
I have iOS app set to 10.0 and added Today extension which was automatically set to 11.4 as the latest. This caused the error to appear. Simply changing the Deployment target of the extension target to 10.0 resolved the issue.
Assumptions
the app I am working is called TestApp (for the sake of privacy)
the steps below are tested in Xcode 11.1
the scheme I was using to compile is AdHoc
the app has the Push Notification capability
Issue
In my case the issue was caused by a discrepancy between the signing of two targets. The issue was between:
the TestApp target (i.e. what in the error is referred to as Parent App Signing Certificate)
the notificationServiceExtension target (i.e. what in the error is referred to as Embedded Binary Signing Certificate).
Resolution
In my AdHoc scheme, under the TestApp target, I disabled the automatic signing because I wanted to specify the provisioning profile and the certificate.
The steps I followed were:
from Signing & Capabilities -> AdHoc -> Signing (section)
removed the tick from Automatically manage signing under selected
selected the provisioning profile I wanted to use
from Build Settings -> Signing (section)
under Code Signing Identity, choose for both AdHoc and Any SDK the certificate I wanted to use
under Code Signing Style -> AdHoc, chose Manual
under Provisioning Profile -> AdHoc, chose the provisioning profile I wanted to use (i.e. the same as step 1.2)
The error was thrown because I didn't apply the same settings to the notificationServiceExtension target (which was still using the automatic signing and therefore another certificate). As soon as I have repeated the steps above also for this target, the error was gone.
I hope it can helps someone, because this error drove me crazy!
It seems this issues appears in xcode 10 and the resolution is different from the aforementioned.
I was able to fix (or rather bypass) the error by setting the Build
System to Legacy (via File > Workspace Settings)
Another interesting thing to note is that the signing error would not
occurr if I was building to an actual device (i.e. before changing the
Build System to Legacy). It would only occurr when building using the
simulator and only on Xcode 10 beta 3, 4 and 5.
Link to the original thread: https://forums.developer.apple.com/thread/105537
I was having this issue when I migrated to Xcode 10 and managed to fix it by updating the architectures in "Build Settings"> "Valid Architectures" for the Watch target to
$(ARCHS_STANDARD)
This thread helped me out a lot: https://forums.developer.apple.com/thread/107563
Oddly enough, I had to remove the products folder from my project in order to fix this error. Xcode crashed then, after reopening, worked like a charm!
I got this error when the App Groups weren't set up correctly on all my App IDs in the Developer Portal. Therefor the App Groups in the app didn't work correctly and the Binary for the extension or the Watchkit app couldn't be signed.
check your Excluded Architectures
I got this error after adding a Copy Files Build Phase to the main app Target.
Copy Files
Destination: Absolute Path
Path: /Applications
File: MyApp.app
This worked the first time I ran the app.
On subsequent runs, Xcode began complaining about the certificate mismatch.
Removing the Copy Files build phase fixes the certificate mismatch. I'm still searching for a way to Copy Files without the error.
Same issue links:
https://stackoverflow.com/a/32802258/1265393
https://forums.developer.apple.com/thread/102707
https://github.com/Bouke/SwiftInitializerGenerator/issues/6
I had the issue when following the SwiftUI documentation about integrating an iOS app with watchOS.
The issue is that the extension is not under the same development team, so it will fail when we try to compile it.
Nothing about architecture and nothing about trust.
SOLUTION:
ScreenShot for xcode
Go to the project general file
Check on the extension folder on the sidebar (check the screenshot number 2)
Switch to the Signing & Capabilities tab
Choose your team (need to match the master project's development team)
I had this problem with a Photo Editing Extension. I eventually discovered that it was due to my unusual project structure.
My project includes a local Swift package containing all the source code and resources for the appex (app extension).
The appex links the library created by the Swift package.
The appex has no source files of its own. The “Compile Sources” build phase has no files, and it has no “Copy Bundle Resources” build phase.
On a clean build, Xcode builds the appex and embeds it in the app successfully.
On an incremental build, even with no changes to any file, Xcode fails during the “Validate MyEx.appex” step.
The problem, it turns out, is that Xcode re-links the appex executable every time it builds, even if nothing has changed. And Xcode does not then sign the new appex executable, except during a clean build.
This means that the appex executable is always unsigned after an incremental build, so it is never signed with the same certificate as the parent app (because the appex isn't signed at all).
My solution was to add an empty file, dummy.swift, to the appex target. That is sufficient to make Xcode only re-link the appex when needed, and to always sign the appex after linking during an incremental build.
I got this error while having another compile time error in my code.
My new target has never been built before.
So I thought I'll fix this error first. But it turned out, that fixing the other error enabled Xcode to build the target and fix the other error itself.
Check if you have more targets like oneSignal or other else and check if you have the same team of the main target.
I was getting this error trying to build a WatchOS app in Xcode 11 - I tried all the various suggestions in this and other SO posts but the thing that finally worked was switching Xcode to use the legacy build system.
Go to: File | Project (or Workspace) Settings | Build System
And select Legacy Build System
XCode 12.5
In my case, I followed Shakeel Ahmed's answer. But I also needed to do this change on the Pod file.
You can find more here https://github.com/facebook/react-native/issues/31480#issue-876308920
I have experienced this same issue in a Unity.iPhone project.
We embed a target for a Stickers extension that we ship with the app.
The Stickers extension target is the one complaining about the code sign settings not matching the parent apps.
error: Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target's code sign settings match the parent app's.
Embedded Binary Signing Certificate: Software Signing
Parent App Signing Certificate: Apple Distribution
This occurred when the Stickers Extension target build settings were set to ARCHS_STANDARD (arm7, arm64), while the parent app was set to arm64.
I fixed this by setting the Extension's ARCHS build property to arm64.
Go figure, I suspect this output catches a bunch of different issues and just doesn't specify any details in the log message.
Check your keychain access expire certificate not deleted that's why its showing a error.
In my case the key was to delete 'Products' folder. Then the build was successful. Moreover, after that I made git reset --hard and tried again with the same successful result.

Swift: App Installation Failed Could Not Inspect The Application Package (When Using Frameworks with XCode 6)

I'm having difficulties running a compiled app on an iPhone 6 (iOS8). It works fine in the simulator.
I get this error message:
App installation failed
Could not inspect the application package
Originally there were error messages - such as the one here but I fixed this temporarily by moving the output into the correct location. However even though all of the libraries are being codesign'ed correctly and are now found I am unable to use the app on my device.
There seems to be no further error messages and therefore no way of debugging anything. How exactly do normal iOS developers debug problems which give no error messages?
I guess the underlying problem is that my project is getting quite complex, there are a lot of moving pieces: a few cocoapods, Alamofire, ReactiveCocoa, and Moya.
I have a few general questions:
Where can I find information that documents the use of frameworks in XCode 6?
What is the difference between "Build Phases -> Link Binary With Libraries", "Build Phases -> Copy Files", "General -> Embedded Binaries" and "General -> Linked Frameworks and Libraries"?
Everything is compiling completely fine for the simulator, including the cocoapods, but I note that there are libPod.a files and wonder whether they need to be compiled into the app?
Mostly I am hoping to find some way of finding out why the application package can't be inspected. Surely whatever software that inspects this must be able to be debugged?!!
Edit:
For the record, (1) there is no file called Resources in the root folder as I get nothing back when I do this "find . -name Resources" so it cannot be that issue, (2) I have run "Product -> Clean" and then tried to build again and this does not solve the problem either, (3) the Info.plist does contain a CFBundleName which is set to "${PRODUCT_NAME}" currently (which I believe is set elsewhere.)
I managed to fix this. I am not sure exactly what the solution was, but effectively what I did was to remove all of the cocoapods, detach all of the extra projects that were being used to compile frameworks, and then completely clean the build folder (by holding Alt while going to Product > Clean.)
I then added each of the frameworks back and made sure that each of them would compile.
I checked the build output and near the bottom of each I was able to find the location in which the frameworks were being built.
I then went back to the parent app, and was able to change the framework search paths to include the folders that the frameworks were being built in.
I may have changed a couple of other paths, too, though I cannot remember completely.
I think that basically the issue was a combination of (1) a very dirty build path, (2) leftover files and bad configuration causing issues, (3) frameworks being built in the wrong location.
check your "Copy Bundle Resources",delete info.plist if it contained.
It's work for me in Xcode 6.4

OS X Framework Library not loaded: 'Image not found'

I am trying to create a basic OS X Framework, right now I just have a test framework created: TestMacFramework.framework and I'm trying to import it into a brand new OS X Application project.
I have built the .framework file and imported it into the new project, The framework appears to link okay, and I can reference the public header file I added to the framework build phases section.
However, when I try to run the container Application I get the following Error:
dyld: Library not loaded: /Library/Frameworks/TestMacFramework.framework/Versions/A/TestMacFramework
Referenced from: /Users/samharman/Library/Developer/Xcode/DerivedData/TestMacContainer-dzabuelobzfknafuhmgooqhqrgzl/Build/Products/Debug/TestMacContainer.app/Contents/MacOS/TestMacContainer
Reason: image not found
After a bit of googling I realised I needed to add a Copy Files section to my container application build phases, so I have done this and set it up like so...
However, I am still getting the runtime error. I'm obviously doing something wrong here, but the Apple developer library resource for this references Xcode 2, so isn't very helpful!
What have I missed?
UPDATE:
I can see in the build log that my TestMacFramework.framework is being copied into the .app contents/frameworks directory, but it isn't being installed to the Library/Frameworks directory on the HD
UPDATE 2:
The build links correctly if I manually copy the TestMacFramework.framework into the Library/Frameworks directory
[Xcode 11+]
The only thing to do is to add the framework to the General->Frameworks, Libraries And Embedded Content section in the General tab of your app target.
Make sure you select the 'Embed & Sign' option.
[Xcode v6 -> Xcode v10]
The only thing to do is to add the framework to the Embedded binaries section in the General tab of your app target.
So I managed to get it working, it's quite simple when you have the right instructions. What I was looking for was a 'private' framework which lives in the App bundle rather than being written to the system library folder.
Building The Framework
Add a target to create a Cocoa Framework
Within that targets 'Build Settings' configure the 'Installation Directory' to '#executable_path/../Frameworks'
Build library, and access the .framework from the archive or products directory
Including The Framework
Drag the created .framework file into the Xcode Project, be sure to tick 'Copy Files to Directory'
In the containing applications target, add a new 'Copy File Build Phase'
Set the 'Destination' to 'Frameworks'
Drag in the created .framework
It was quite simple for me, i just added my framework to my embedded binaries under app targets
The options above where not possible for me to include.
I solved it by specifying the Runpath Search Path
This is on the 'Build Settings' tab.
In the 'Linking' section.
Change 'Runpath Search Paths' into $(inherited) #executable_path/Frameworks
I ran into the same issue but the accepted solution did not work for me. Instead the solution was to modify the framework's install name.
The error in the original post is:
dyld: Library not loaded: /Library/Frameworks/TestMacFramework.framework/Versions/A/TestMacFramework
Referenced from: /Users/samharman/Library/Developer/Xcode/DerivedData/TestMacContainer-dzabuelobzfknafuhmgooqhqrgzl/Build/Products/Debug/TestMacContainer.app/Contents/MacOS/TestMacContainer
Reason: image not found
Note the first path after Library not loaded. The framework is being loaded from an absolute path. This path comes from the framework's install name (sometimes called rpath), which can be examined using:
otool -D MyFramework.framework/MyFramework
When a framework is embedded into an app this path should be relative and of this form: #rpath/MyFramework.framework/MyFramework. If your framework's install name is an absolute path it may not be loaded at runtime and an error similar to the one above will be produced.
The solution is to modify the install name:
install_name_tool -id "#rpath/MyFramework.framework/MyFramework" MyFramework.framework/MyFramework
With this change I no longer get the error
Deleting derived data saved it for me
None of these issues solved this for me. The problem in the end was pretty easy. It looks like its a pretty major Xcode bug which I have logged the problem and fix under Apple bug: 29820370. If you are struggling (as it seems like there are several pages of problems similar to this ) then it would be great if you can raise a bug on bug reporter: https://bugreport.apple.com/ and reference the bug I raised to gain visibility. I want to make Xcode back into the pleasure that it was before - and this is something I am sure Xcode should have fixed itself.
Here is the fix:
1. Open Keychain - go to Apple Worldwide Developer Cert.
2. Double Click on it
3. Change the permission level from "always trust" to use System Defaults
4. Save and close it
5. Restart Xcode, Clean and build your project and it should be gone.
Screenshot below of the correct settings:
Hope this helps!
When you drag a custom framework into a project under Xcode 10.1, it assumes that the framework is a system framework and puts the framework into "Link Binary With Libraries" section of "Build Phases" under your target.
System frameworks are already on the device so it is not copied over to the device and thus cannot execute at runtime so KABOOM (crash in __abort_with_payload, and disinforming error: "Reason: image not found"). This is because the framework code is not copied to the device...
In reality, to have Xcode both link the custom framework and ensure that it is copied along with your code to the iOS device (real or simulator) the custom framework needs to be moved to "Copy Bundle Resources". This ultimately packages the framework along with your code executable to be available on the device together.
To add a custom framework to a project and avoid the Apple crash:
Drag custom framework into your iOS project file list
Click ProjectName in Navigator -> TargetName -> "Build Phases" ->
Link Binary With Libraries disclosure triangle
Drag custom framework out and down to "Copy Bundle Resources" section below (Xcode now moves the framework reference, fixed in Xcode 10)
Run in simulator or device
The custom framework thus gets copied along with your code to your target device and is available at runtime.
[editorial: you would think Xcode would be smart enough to figure out the difference between one of it's system frameworks which need not be copied to the device and a custom framework that is, oh I don't know, in the project root directory hierarchy... 🙄]
Xcode 11 :
in Xcode 11 add framework into General->Frameworks, Libraries And Embedded Content
after adding make sure you select Embed & Sign option
There should be a 'Run Script' into 'Build Phases' with this: '/usr/local/bin/carthage copy-frameworks'
On the 'Input Files' of that 'Run Script', you should add the path to your libraries. Like this:
If you accidentally reset your keychain, this can occur due to missing Apple certificates in the keychain. I followed this to solve my problem.
I had the same issue and was able to fix by re-downloading the WWDR (Apple Worldwide Developer Relations Certification Authority).
Download from here: http://developer.apple.com/certificationauthority/AppleWWDRCA.cer
If you are using Xcode 11, ensure that you have the framework added in Frameworks, Libraries, and Embed Content under Target settings - General. Change Embed status from - 'Do not Embed' to 'Embed & Sign'
What solved it for me was changing abstract_target to target for the main target in my Podfile. I had previously set it to abstract_target and this caused the described error. Now it works like a charm
I faced this issue with Xcode 13 betas with the UniformTypeIdentifiers.framework. The app failed to run on iOS versions lower than 13.
The below approach fixed the issue :
Go to the target -> Build Phases -> Link Binary With Libraries -> Add the framework -> Add the status as "Optional"
The above worked perfectly for me! Hope this helps!
For Xcode 8, some stale products will be removed from derived data folder refer to this solution.
Apple: In macOS 10.12 and later, Xcode cleans up stale derived data, precompiled headers, and module caches. (23282174)
The Xcode build system supports stale file removal of some types of build artifacts that were produced in a previous build, but have since been removed from the project.
Base on the author's thought, I found this build log from my case.
Remove stale build products
/bin/rm -rf /Users/usename/Library/Developer/Xcode/DerivedData/myapp-esvvhwwwwngijeemhatmklwzoxnb/Build/Products/Debug-iphonesimulator/myapp.app/Frameworks/AliyunVodPlayerSDK.framework
/bin/rmdir /Users/usename/Library/Developer/Xcode/DerivedData/myapp-esvvhwwwwngijeemhatmklwzoxnb/Build/Products/Debug-iphonesimulator/myapp.app/Frameworks
After creating a new copy file phase and copy the target stale framework to Frameworks destination, the above removal log disappears after rebuilding.
Just clarify my situation and reason, hope it's helpful for someone.
For me this was the solution, after many hours of searching!!
For some reason, well into the development of a Swift 2.3 custom Framework, Xcode 8 had removed the DYLIB_INSTALL_NAME_BASE setting from the project.pbxproj file. A little walk into the Build Settings / Dynamic Library Install Name Base setting back to #rpath fixed it.
(from https://forums.developer.apple.com/thread/4687)
I found that this issue was related only to the code signing and certificates not the code itself. To verify this, create the basic single view app and try to run it without any changes to your device. If you see the same error type this shows your code is fine. Like me you will find that your certificates are invalid. Download all again and fix any expired ones. Then when you get the basic app to not report the error try your app again after exiting Xcode and perhaps restarting your mac for good measure. That finally put this nightmare to an end. Most likely this has nothing to do with your code especially if you get Build Successful message when you try to run it. FYI
Got the issue when trying Xcode 9 beta and going back to Xcode 8. A simple Clean on the target resolved the issue.
I had the same issue for a different reason.
I've created a new configuration to Debug and Release (under PROJECT -> Info tab -> Configuration).
And I had to change my pod frameworks shell script (Pods-"appName"-frameworks.sh , under Targets Support Files) to make it work.
[Xcode 9]
The only thing that worked for me:
Target > Build Phases > [CP] Embed Pods Frameworks
Uncheck "Show environment variables in build log" and "Run script only when installing"
I tried many fixes, but what worked for me was to delete a missing target listed in the build tab of the build scheme. You can get to it by opening the edit window of the current scheme.
Edit: My UI testing target was not working as well, and the solution I found was to delete it and generate it again.
open xcode -> general -> Embedded Binaries -> add QBImagepicker.framework and RSKImageCropper -> clean project
just add QBImagePicker.framework and RSKImageCropper.framework at embedded binaries worked for me
I think there is no fixed way to solve this problem since it might be caused by different reason. I also had this problem last week, I don't know when and exactly what cause this problem, only when I run it on simulator with Xcode or try to install it onto the phone, then it reports such kind of error, But when I run it with react-native run-ios with terminal, there is no problem.
I checked all the ways posted on the internet, like renew certificate, change settings in Xcode (all of ways mentions above), actually all of settings in Xcode were already set as it requested before, none of ways works for me. Until this morning when I delete the pods and reinstall, the error finally gonna after a week. If you are also using cocoapod and then error was just show up without any specific reason, maybe you can try my way.
Check my cocoapods version.
Update it if there is new version available.
Go to your project folder, delete your Podfile.lock , Pods file, project xcworkspace.
Run pod install
I experienced that problem only when running on real device (iPhone SE). On simulator project worked as expected.
I did try all fixes from this very thread and from here.
None of those worked for me.
For me problem was solved after restarting iPhone (sic!).
I did:
clean build folder,
clean derived data,
delete app from device,
reboot device
And it finally works. :)
If every other solution fails don't forget to try it out.
Xcode 11 :
Build Phases -> Embed Frameworks
This might happen with Pod Frameworks.
I was facing the same issue with AnswerBotProvidersSDK.framework and my mistake was, I set Run Script checked for Install builds only in targets build phases.
Incorrect settings:
Correct Settings:
For me for some reason xCode (12.5 up to this moment) decided that my Notification Service Extension Target should not have correct paths to frameworks. I suspect that this is happened after I've updated from xCode 12.1 to 12.5.
So I was getting the same error related to one of my internal frameworks. To fix this problem do the following:
go to Project's General Tab
Select your target (in my case it was Notification Service Extension Target)
Make sure that Framework and Libraries section contains your missing framework. I've left it Embed Without Signing in my NSE Target, but it is also was added with Embed & Sign to my primary app target
Keep your target selected and switch to Build Settings tab
There in a search bar enter LD_RUNPATH_SEARCH_PATHS (make sure that All possible settings will be displayed and not just Basic)
You will see Runpath Search Paths and it was empty for me.
Add 3 following values there:
$(inherited)
#executable_path/Frameworks
#executable_path/../../Frameworks
This is what helped me.

Apple Mach-O Linker Error even with the .m files added to Compile Sources of Build Phases

I know this is some typical beginner question to use Xcode, but it's just confusing.
Basically, I git cloned a project from github.
https://github.com/gandg/webrtc-ios
https://github.com/soulfly/webrtc-ios (forked)
Both projects are updated fairly recently,
AppRTCDemo.xcodeproj some refactoring 18 hours ago
and the readme says:
To build XCode iOS app only:
project location: webrtc-ios/ios-example/AppRTCDemo.xcodeproj
Open the XCode project and set target for iPad
Build and run
Should work without changes
but, end up with many warning and errors.
Yes, I understand Apple Mach-O Linker Error typically occurs when *.m files are not added to Compile Sources of Build Phases, so I confirmed that.
It looks like the whole *.m files are included there (see the last attached image), so I know nothing to do more.
Can anyone give advice on this issue? Thanks in advance.
As I understand you are trying to build app to the iPad simulator.
Seems like this project doesn't work in iOS simulator, only on real device
Here is how Xcode looks like when I use real device - no errors:
Here is how Xcode looks like when I use iOS simulator - lots of errors like in your question:

Resources