Duplicated target: Xcode cannot run using the selected destination - xcode

(OS X, not iOS): "Choose a destination with a supported architecture in order to run on this system"
Fixed the copied .plist in the Build settings, removed spaces from the new product name. Can't find any difference with the original target's settings, still this dreaded error. Any ideas?

I got this error when I opened an old project under Xcode 4.5. The problem: The build setting were set to Standard Architecture, which means 64bit and 32 bit, while the minimum deployment target was set to OS X 10.4.
Setting the minimum deployment target to OS X 10.5 fixes the problem.

When i faced this issue, on top of the xcode window i changed My Mac 64-bit to My Mac 32-bit. It worked for me.

For me it was a mismatch between the filename of the executable, as specified by "Product Name" in the target build settings, and the executable filename indicated in the Info.plist. In fact, when you duplicate a target, you get a "copy" suffix that you usually change right away, and this may lead to some mistakes.
An additional indication of this mismatch can be seen when selecting the product app in Xcode, and opening it in the Finder. If the app icon is overlayed with a kind of "stop" sign, here it is, your app isn't executable.

If everything looks alright, one last thing that you should check contents of your app.
Most probably application name Info.plist file does not match what you have in your build configuration.

With Xcode 4.5.2. (4G2008a) this issue has gone away, apparently. I can now make a duplicate of the original target, fix the product name, and get a properly running application.

I started getting the same thing. I did a Clean and it seems to have fixed it.
Lion/Xcode 4.6.2

I got the same error message after accidentally copying a binary to /usr/local/bin. The binary was "manually" generated by Makefile - the building process of Xcode (5.1) was configured to place the binary in /usr/local/bin too. Removing the manually generated file and starting the build again fixed the problem.

Related

Codesign: What are unsealed contents?

I have just upgraded to XCode 6 and tried to build my Developer ID signed Mac app.
However, I now get the following codesign error:
unsealed contents present in the root directory of an embedded framework
This applies to the Dropbox.framework that I use. Obviously that could not be signed. What does the error mean? What is wrong?
Have a look at OS X Code Signing In Depth
Beginning with OS X version 10.9.5, there will be changes in how OS X recognizes signed apps
Structure your bundle according to the expectations for OS X version 10.9 or later:
Only include signed code in directories that should contain signed
code.
Only include resources in directories that should contain
resources.
Do not use the --resource-rules flag or ResourceRules.plist. They
have been obsoleted and will be rejected.
The problem is the version.txt file that resides in the Dropbox.framework. While this is useful to know which version the framework is, it seems no longer to be OK for codesigning.
When I removed the file everything worked fine again.
Had the same problem for several hours today, as I tried to adapt a pre-Yosemite .framework bundle to Yosemite. In the end, the problem was the symlinks I made, not strictly files in the directory.
Initially, the package had a broken symlink in its root directory. I fixed it up.
The symlink I added:
Headers -> Versions/Current/Headers/
What it needed to be:
Headers -> Versions/Current/Headers
That extra slash is the killer.
Note that this bit me twice in two different spots: I also had
Current -> 1.8.0/
where I needed
Current -> 1.8.0
I'm not much of a *nixer, so maybe this is common sense, but hopefully it helps other windows devs like myself.
I ran into a similar issue today... my error was "unsealed contents present in the bundle root". The fix for me was to remove the custom icon I had on on my app. AppName.app/Icon? was corrupt somehow...
I researched this for a while today and none of the suggestions I found helped, my sdl_mixer.framework had five embedded frameworks that I couldn't get past iTunesConnect. My solutions was to remove three of them that I didn't actually need, and the other two were added to my project as standalone frameworks, not embedded in the sdl_mixer. Hopefully this helps someone, I spent hours on this.
In my case, I was trying to sign an app with some old frameworks inside. None of these suggestions helped. Turned out I had to remove the PkgInfo file from inside a framework to get this message to go away.
I had such error:
<some_path>: unsealed contents present in the bundle root
Command CodeSign failed with a nonzero exit code
The issue was that I used a custom CONFIGURATION_BUILD_DIR[About]. And after some changes(changing macOS and iOS platforms) it occurred
And when you clean your project this custom location build is not cleaned(like derived data). To solve this problem remove content of this folder manually
I have hit this twice now, so I am adding the causes, since codesign is very opaque and generally refuses to tell you what the problematic resource is.
On one occasion, I had an unsigned binary executable. Each executable and framework needs to be individually signed before singing the bundle as a whole.
Then I hit another case. I sign my code as part of the publish process, re-signing each executable and framework. But Xcode also signs the bundle as well, and it turns out that was leaving cruft behind in _CodeSignature folders. So now, before signing each of the executables and frameworks and then the bundle, I pre-remove Xcode's generated _CodeSignature folders with something like:
find MyApp.app -name _CodeSignature -type d -exec rm -rf {} +
Hopefully this hard-won information will save someone some time one day.
I had the same problem and what worked for was deleting the contents of the DerivedData folder. Xcode doesn't say which resource is causing the problem, so I rebuilt everything from scratch. Clean didn't work either.
I hit the problem when I tried to sign another framework, the answers here are very inspiring, here must be some problems with the framework structure, but I did find any them. The structure seems to be right, the symlinks have not tailling "/", there is not extra file (checking with ls) ...
After tons of trying, I finally realized there is a extra .DS_Store in the framework, which is really annoying :(
So if you still hit the error, try to check if there is any hidden files.
Another possible cause of this problem: if you are building iOS and macOS apps that have the same name and the same installed location, you may find that both of them are written into the same app bundle. First the iOS app build places its contents directly in the app bundle root, and then the macOS app build places its contents into a "Contents" folder in the app bundle, and then codesign complains about the iOS resources.

Could not change executable permissions on the application

Just updated to iOS 6 sdk and latest Xcode and get this when trying to build to my 3gs.
I 've added armv6 under valid architectures?
"Could not change executable permissions on the application"
I could solve it erasing an application that I had previously uploaded using the same Bundle Identifier (xcode get's confused doing the chmod). Try checking the log from xCode Organizer (Your device's Name -> Console) you should get information from that log. Good luck!
folks, i get this resolved
- because i already have the same app using the same bundle identifier installed on the phone.
- what you need to do is to delete all those apps on your iphone which is using the same bundle identifier name.
- you'll make it!!
You probably have a different target name. You can start the app from scratch, but you'll need the same target name and the same bundle identifier.
Delete the apps that were already installed on iphone/ipad with the same Bundle identifier.iphone/ipad gets confused with the apps with same bundle identifier. so change change the Bundle identifier of the current app or delete the app that was already installed.
It can happen when you launch the app from Xcode and you have the appstore version installed in the phone with the same bundle-id but a different name. In my case I'm using App_Beta when in the appstore is App.
If the two versions does not have the same product name you wont be able to test the upgrade from the old to the new version. To solve make the names match.
I went into the Organizer and selected the Applications underneath my test device. Even though I had deleted the application on my device itself, it still showed up in my list of applications. I deleted it there, and this took care of the issue for me.
You need to delete all the app's using the same bundle identifier. I did the same, but still the same error persisted on my iPod, i cleaned the (cmd + shift + k) the build and restarted the iPod and i was able to run the app on the iPod.
You just delete the apps that were already installed on your device with the same identifier.
I ran into the same problem, but I needed to keep the current installed App in the device for debug purposes. My solution was to use the same:
Target Name
Bundle identifier
Product Name
I had this error, and what fixed it for me was Product Name under Build Settings. I had changed it to something else, and started getting this error. I changed it back and it fixed it.
Just delete all the previous versions of the application. Due to mismatch/confusion about bundle identifier it happens.
I removed all the existing application with the similar identifier and was able to install.
I was able to resolve this error message simply by unplugging the USB cable, and plugging it in again after a few seconds. YMMV!
You need to make sure that your device is not set to two applications with the same Bundle ID.
I had this error when I tried copying and pasting one xcode project to build another app. What I had to do was change the bundle identifier name to something different than my previous app.
Could not change executable permissions on the application
Cause: I had icons in the files system named 29x29.png, 58x58.png, 72x72.png, etc. I had soft links (ln -s) with the required names per App Icons on iPad and iPhone. For example, Icon-Small.png was a link to the real file 29x29.png.
I did this because my program runs on different platforms, from mobile phones to desktops. Android, Apple and Microsoft all have similar requirements. So "one set of icons" and "different links for different OS" made the most sense to me.
Fix: Don't use links. Apple does not tell you that. And their error message of "Could not change executable permissions on the application" is useless.
Looking at all the different answers (and causes), it looks like lots fo things can cause it.

Xcode fails without specifying and errors

All of a sudden my project fails to build in Xcode. If I look at the log I see all the needed dependencies being built, and then I get a strange error:
Verify final result code for the complete build operation
Build operation failed without specifying any errors.
Individual build tasks may have failed for unknown reasons.
I removed my code directory and replaced it with a backup, did a clean, tried building all the other components separately (they succeed) - nothing works. I tried a command line build, same issue.
There were only a few hits on google for this error, none offered any useful advice.
Can anyone please help?
Update: When I run the command line build, I see the following error:
2012-05-25 08:55:53.830 xcodebuild[3358:4203] No recorder, buildTask: <Xcode3BuildTask: 0x400f35e60:'ProcessPCH MyProject-Prefix.pch':REfc(32370056113422336):deps=0:phaseNum=4>
I checked the output of xcodebuild and it is returning '65'.
I thought there might be a problem with the MyProject-Previx.pch file, so I shut off "Precompile Prefix Header", and now I get the same error with a different file:
2012-05-25 09:15:11.784 xcodebuild[3882:3703] No recorder, buildTask: <Xcode3BuildTask: 0x40048ab60:'CompileC HelperRoutines.m':REfc(33777199068741632):deps=0:phaseNum=4>
Build operation failed without specifying any errors. Individual build
tasks may have failed for unknown reasons. One possible cause is if
there are too many (possibly zombie) processes; in this case,
rebooting may fix the problem. Some individual build task failures (up
to 12) may be listed below.
I've run into this problem consistently recently while running Xcode 9.0 Beta 3 and Xcode 8.3.3.
The fix is to delete ALL in the Derived Data folder. It then seems to work again.
rm -rf ~/Library/Developer/Xcode/DerivedData
NOTE: just cleaning the build or deleting the current build folder for a project does not seem to help.
Hope this helps :)
I was hitting this error and it infuriated me for an hour or so. The answer below helped me out a lot: essentially your machine has a ton of running processes, XCode can't handle it, and rebooting your machine is the best answer.
https://stackoverflow.com/a/13183522/1863655
I looked around for a bit and the only one that worked for me was shortening my project folder name.
All other tries: restarting, recloning, deleting derived data, etc. didn't work. The only thing that worked was making the project folder name shorter.
I also encountered same error. I was edited .pch (Prefix Header) file. Then I started getting this strange error.
Then I removed all editions which I made in .PCH.
Then I quit my Xcode.
When I restarted Xcode this strange error was gone.
Hope this will work for you also.
Best luck Buddy (y)
Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie) processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.
This happens occur when the total path length is too long.
change the folder name or location of directory, shorter then before.
Happy 2019, everyone, but sad to say this can still happen in Xcode 10.2.
I had four projects open in Xcode but only one failed in this way. I tried a main menu > Product > Clean Build Folder. The little progress spinner started up and 5 minutes later was still spinning. Hmmmm.
So I quit Xcode and in Terminal did a cd ~/Library/Developer/Xcode/DerivedData. Although ls -alww showed only one subfolder named after each of my other projects, as expected, there were five subfolders whose name began with the name of the problem project. I deleted all of them
rm -R ProblemProjectName-*
and relaunched Xcode. Problem solved.
Mine gave this error sometimes, also LLVM failed with exit code 1 and clang failed with exit code 255, at different code locations each time. I just had to reboot (OS X 10.7, Xcode 4.5).
I rebooted, no luck. Then I noticed that when I relaunched XCode, one of my tabs was loaded with no file in it. I figured out what file I was editing in it, opened it, saved it and then I was able to build.
None of these answers worked for me on XCode 5.
Luckily, I'm still only testing XCode 5 - I kept XCode 4 around.
XCode 5 simply won't build one of my two projects, claiming that my libraries aren't built with the right settings, and I keep running into the error described on this page on the other one... so I'm sticking with XCode 4, which builds both of my projects perfectly well.
If you are experiencing this issue on XCode 5, consider "reverting to XCode 4" as another strategy.
Overall the idea that repeatedly running a program, XCode or not, degrades your system to the point where you have to reboot does not fill me with confidence in that program.
With Xcode 5.0.0, this error was caused after an update to the CLI tools.
Updating to Xcode 5.0.1 and installing all the required components again still didn't fix the error. However, 5.0.1 was kind enough to actually emit an error that was useful.
/bin/mkdir -p /Users/xxx/Documents/XCode/SampleApp/bin/SampleAppDebug.app/Contents
error: (null)
This lead me to look at the bin folder, and find out that the 5.0.0 build with broken CLI tools had made a symlink in bin/ to the derived information folder with SampleAppDebug.app, which for some reason it could not write to.
I manually removed all contents of the bin/ folder and rebuilt without errors.
I faced same problem. I have change my System time.I delete file "/Users/YOURNAME/Library/Developer/Xcode/DerivedData/ModuleCache/YOURBUNDLEID/UIKit.pcm". Then it's work fine for me. Try this.
I added into the Framework search paths the header file location.... removing this from the top level project settings fixed the issue for me.
Change at your peril.
The only workaround, that works for me - push your code to git repo and clone it to new location.
I highly recommend to reclone your repo, because you'll deal with some random problems if you prefer rebooting/turning off and onXcode.
did you set "Perform Single-Object Prelink" to Yes?
try turn it off.
i had the similar problem. i have tons of files in a static library. reducing the number of files or setting "Perform Single-Object Prelink" to NO solved my problem.
Same error and following didn't work for me for Xcode 6.3.2 on Mac OS X Yosemite 10.10.3:
Git discarded changes to last successful build point
Creation of new fresh project from scratch from a builtin template (though I cannot recall whether it built successfully or not)
Restart of Xcode
System Reboot
and the following worked:
I faced the problem in the morning and it got resolved in the evening with a couple of Xcode restarts and System reboots and creation of new project. So, I'm not sure what really triggered.
I faced the same problem today. Cleaning the DerivedData and cloning the project somewhere else didn't help. What fixed my problem was repairing the volume from the Disk Utility app and removal of all Xcode plugins.
I have encountered same issue without having any code changes for my project running on Xcode 9.2. It looks like if you have some run scripts or external build systems attached to the project, this might cause an issue. Try committing or discarding changes and build again. If it still persist, delete local repo and clone again. Also maintain smaller folder names for project location.
Same issue when added watchOS target inside iOS app, using Xcode 11.1 with SwiftUI:
Go to menu Xcode / Preferences / Locations
Open Derived Data folder in Finder clicking on the arrow next to /Users/yourUserName/Library/Developer/Xcode/DerivedData
Locate your app Derived Data folder and delete it
Menu Product / Clean Build Folder
You should be able to compile again.
I know this is super late to answer but I'm answering since none of the above solutions worked.
For me restarting, clean building, deleting derived data nothing worked.
Because the issue was not due to any zombie objects or something like that.
I'm using Xcode 11. I think it's an Xcode bug that sometimes errors are not shown in the issue navigator. But don't worry check the build report in Report navigator(The last tab in project navigator: the one that looks like a comment box with lines in it. or simply cmd + 9).
Click the relevant build and resolve the issue, mine was missing file in pods directory.
just try to rename the folder name of the project. it did the trick for me
I had this same problem, however the accepted solution did not work for me, what worked was:
deleting .workspace file
deleting Podfile.lock file
deleting the Pods folder
pod deintegrate ; pod install
For me it was fixed by changing to the new build system(in File -> Project settings)
I have Xcode 11.7

Xcode error: failed to launch

I have a Mac app I have written to support iCloud. However, I get this when trying to run the app:
error: failed to launch /Users/padsoftware/Library/Developer/Xcode/DerivedData/Scrawl-heofvoywsunchdhjowxkvkoiqvan/Build/Products/Release/Scrawl.app/Contents/MacOS/Scrawl
The odd thing is that this appears for all of my Mac apps, with or without iCloud, with or without sandboxing, with or without entitlements, or ever with or without code signing. Any idea on how to fix this?
I had this problem too. For me, it was a code sign issue. Make sure you're signing with developer, not distribution.
I encounter this problem every once in a while. Like the others mentioned, these are the steps I take:
1. Clean (Shift+Cmd+K) ------
Removes all the product files, as well as any object files (.o files) or other intermediate files created during the build process (Apple Doc)
2. Navigate to "~/Library/Developer/Xcode/DerivedData", delete folder for app in question ------
Derived data consists of project indexes, logs, and build products including intermediate files (Apple Doc)
3. Restart Xcode
One or the other usually fixes it. I haven't had to change Code Signing settings, but that would be my next step. Wouldn't re-install Xcode unless absolutely necessary.
I had such problem also and restarting Xcode Fixed the issue .
even it happened after renaming the application ....
Under Build Settings make sure you are signing with a valid developer profile for debug and release.
Then Build for Testing
That fixed the problem.
"Product"->"Scheme"->"New Scheme" fixed my problem
Just in case it helps anyone else, my problem was fixed by rebooting my iPhone (4S). Then the app suddenly appeared on the Springboard (it was like it was already installed but somehow hidden).
...I did all the other steps (restart Xcode, clean project, delete derived data) but none of it worked this time.
What worked for me... I was already code signed as developer so I cleaned my code
menu bar -> Product -> Clean
That still didn't fix it but I noticed that I was getting handshake error, I had a large amount of apps already running on my phone (~15-20) so I exited out of all of them and retried. It worked after exiting out of all other apps.

Xcode can't find paths that are there

I have an xcode project that was created on another mac. That make was PROBABLY osx 10.5 using Xcode 3. (When I went to install xcode I could only get Xcode 4 AND was required to upgrade my mac to 10.6) anyway, I am experiencing problems compiling this project that compiles fine on the other computer.
I don't know why. The build always fails and I see it is looking for a path incorrectly.
The physical directory layout is like this
/path/devfolder/devfolderMainProject/mainproject.xcodeproj
/path/devfolder/helpinglibrary/helpinglibrary.xcodeproj
/path/devfolder/anotherlibrary/anotherlibrariesFiles/...
But when Xcode starts doing the stuff for the helping library, it returns linker errors and I can see it is looking for files in the wrong places
linker error /path/devfolder/helpinglibrary/../../anotherlibrary/anotherlibrariesFiles/src/correctfile.cpp does not exist
so I browse and see that the file definitely does exist, and that Xcode is looking too many directory up
../../
should just be
../
so that it only goes 1 directory up, how do I make it look in the right place?
Moving the folders around in finder breaks plenty of OTHER things, so I am not sure what to do here.
I suggest you to open the target properties. In the "Build" tab, look for the settings OTHER_LDFLAGS and LIBRARY_SEARCH_PATH. I have a project with a structure just identical to your one and I have edited these properties to inform the Xcode where to look for my libraries. Maybe you can have some wrong value in some of these settings.

Resources