Xcode archive validate button greyed out [duplicate] - ios

I have a problem generating a iOS App archive from an application. The application compiles just fine and even works in the simulator. Now I wanted to make som ad hoc testing and cannot generate the iOS App Archive. When I click on the Product -> Archive it generates a generic xcode archive. Can anyone help me. I should mention, that I have already generated an iOS App Archive of this application. It has just stopped to generate iOS Archive for some reason. Thanks a lot.

Check Build Settings:
Skip install is NO for the main project target
Skip install is YES for framework (sub-projects) targets
In Build Phases for sub-projects, Copy Headers needs to be in Project, not Public (does not apply if building static library)
Installation Directory under Deployment is valid (/Applications for example)

This can happen if you've added a framework/library ... you need to edit the Target->Build Settings of that library and set the 'Skip Install' setting to 'Yes'. When you re-archive, XCode should start producing a 'iOS App Archive' again rather than a 'generic xcode archive'.

In addition of Skip Install to Yes and in case you opened another lib/framwork project within your app project you have to move headers (if any) from public to project in the Build Phase / Copy Headers.

I did the following to make it work for me:
I had a three20 static library, I used cocoapods to include the files within the main project
followed the skip install for all other sub projects/static libraries and switched the copy headers from public to project as stated above
most importantly: in each library your project uses go to build phases -> Copy Files and ensured that destination is changed from Absolute path to products directory. Note: see the hint below to narrow your search to find the library causing this error.
and that was it!
hint: to get an idea of the offending files that's causing your archive to create an archive file rather than an ipa do this:
Select the archive and click the Distribute button.
Select the 'Save Built Products' option.
Hit Next and Save.
Browse the created directory in Finder.
The 'libraries' subdirectory will identify the libraries that you need to set the Skip Install to Yes.
in some cases usr/local/include will identify the culprit header files you need to move from Public to Project or the files that you have to change from absolute path to products directory (or even the files you forgot to set the skip install to yes flag). but that directory (ie usr/local/include) varies depending on your sublibrary directory structure. In many cases.. you will see all the files listed under Copy Files in step 3 above listed here. If you find them here, then you have a definite answer for the cause of your problem.
update to hint: to make life even more simpler.. whatever files appears under step 4 in hint above.. simply search for it in the global search of xcode.. and you should get immediate results for what you want.. for example, this was the content of my folder (following the steps in hint above):
So I could tell it has something to do with the crypto and ssl libraries.. searching for them:
made me realize that i forgot to set skip install to yes.

If you export the archive, open it and see /urs/local/include in Products try this suggestion:
In each pod, under Packaging, Private Headers Folder Path and Public Headers Folder Path is set to /usr/local/include. If I clear them then I get a valid archive.
Worked for me after upgrading my React Native app to 0.11.0, Xcode 7 and CocoaPods 0.39.0.beta.4.

If you're using CocoaPods as well as WatchKit or a Today Extension, there is an open issue on the CocoaPods repo explaining what your problem might be.
The solution for me was to remove the Copy Pod Resources phase from the WatchKit Extension and Today Extension targets under Build Phases. The project compiled and archived as expected once I did this.
Hope this helps someone, this had me stumped for an entire day!

If any of the above answers don't work, your issue is probably with cocoaPods. The latest update 0.38.1 messed things up for me, but then i downgraded to 0.37.1 and things returned to normal. Using Xcode 6.3.1
Later edit: updating to 0.38.2 will also fix this. More info about what caused this issue here: Cocoapods 0.38.1 failed to create valid Archive

Although I'm using Xcode5 and what sorted it for me was editing the Build Scheme - trying all of the above suggestions that were applicable didn't help in my case.
I had two targets, say, "App" and "App FREE". My problems with the generic archive happened when I was trying to Archive the FREE version, which I added after the 'normal' version of the app. In my case, when I selected its Scheme in the toolbar and chose Edit Scheme ... I saw that Build section had two targets, namely App and App FREE.
I unchecked all columns for App, leaving only App FREE's columns checked, and clicked OK. Next time I chose Product > Archive I got my App FREE instead of a Generic Archive. :)

If you have only single project, maybe this solution would be useful.
This problem had occurred, when I duplicated the target. As a result I had two targets parallel built. This was causing the issue. Generic IOS archive was built.
To turn the parallel built off go to
Manage schemes,
Edit scheme,
Build,
Remove the other target.

I had this problem after updating to iOS 9 and Xcode 7. Josh H's solution worked for me:
In each pod, under Packaging, Private Headers Folder Path and Public
Headers Folder Path is set to /usr/local/include. If I clear them then
I get a valid archive.
I also made a post install script for my Podfile to do this automatically!
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['PUBLIC_HEADERS_FOLDER_PATH'] = [""];
config.build_settings['PRIVATE_HEADERS_FOLDER_PATH'] = [""];
end
end
end
Just add it to the bottom of your Podfile and run pod install

I had this issue. In my case, it was caused by keeping a Mac app target as a dependency of the iOS app.
The reason it was setup like this was that the Mac app was a tool used to generate some data for the iOS app, which was then included in the bundle.
I had to remove that dependency and build the tool separately before making a build of the iOS app itself.

In my scenario I was getting the erroneous "Generic Archive" only after I began including Swift code in my predominantly Objective-C project. After lots of troubleshooting and examination of the archive file that Xcode was spitting out, I noticed that the SwiftSupport folder (with the required dylibs for the Swift runtime) was in a different place in my archive than from a vanilla brand-new Swift project app archive.
I found the Installation Directory build setting and noticed it was set to a custom path in my project. I simply deleted it (setting it to its generic value of /Applications) and the next Build -> Archive I did worked as expected and gave me a proper iOS App Archive.
TL; DR: Make sure your Installation Directory build setting is set to its default value of /Applications when including Swift code in your app, especially if you are starting with an older project file that may have some unexpected legacy build settings.

I have multiple project in my workspace, (GTL, Pods and my main project) and this is what worked for me:
Select the Project, there will be 2 types there, there's the Project and there's the Targets.
For projects that is not your main like GTL or PODS:
Projects:
Skip Install = NO
Installation Directory = /Applications
// For pods
Private Headers Folder Path = ""
Public Headers Folder Path = ""
Targets:
Skip Install = YES
Installation Directory = /Applications
// For pods
Private Headers Folder Path = ""
Public Headers Folder Path = ""
For the main project (which is usually named the same as your product name):
Projects:
Skip Install = NO
Installation Directory = /Applications
Targets:
Skip Install = NO
Installation Directory = /Applications
Check the ios deployment target on each projects and targets to make sure they are all the same.

Leaving this here to save others from the same journey.
I found I needed to remove the same Copy Pod Resources build phase from a static library target in my workspace too.

Addition to Alex L 's answer.
Point 3. Change 'Build Settings' -> 'Public Header Folder Path' to 'include/xxx' also works.

If none of the above helped you...after a lot of time.......
I deleted the value in the Info.plist for Bundle Version because I was happy enough with just Bundle Version Short 1.0. Bad. Don't do this.
*Note I actually did this by editing it in the UI on the right not realizing it would put an empty key in the Info.plist file. I think that makes it invalid. My bundle showed up as other items while archiving and had no icon, and I couldn't upload to anywhere.
This boils down to invalid values in the Info.plist. If it's not a valid archive, try unzipping an old archive and dropping in / overwriting your current one and see if it fixes it when rebuilding the archive.

Go to Build Settings and add
yourAppName/Resources/dist.plist to the Code Signing Entitlements
Press cmd + B with iOS Device or a Real Device selected as Build Target
When done -> scroll to "Products" folder and right-click on yourAppName.app
Choose "Show in Finder"
Create a folder with Name Payload (capital "P")
Copy yourAppName into your Payload Folder
Create a zip from your Payload Folder
Rename the zip to yourAppName.ipa
DONE

After trying just about everything:
Clean, Archive
delete DerivedData, Archive
restart Xcode (I was using XCode7), Archive
combinations of above...
I then noticed my boot partition was 'low on free disk space'... about 1GB or so.
I rebooted, then got about 18GB free.
Then opened Xcode and project, performed Archive... and surprisingly (after an hour of trying to build an Archive) I finally got a non Generic Archive.
No idea if its a free disk issue which fixed it or a reboot of the macOS that fixed it, but it worked for me.

If you have any .xcodeproj files in Project>Targets>Build Phases>target dependencies remove it from there and then build your ipa. It works for me. Cheers
You can get answer here : xcode is creating generic xcode archive instead of iOS App Archive

In my case, i had to move both FMDB and BlocksKit to static libraries. Previously they were built as subprojects. Remember you can use lipo to create universal libraries. When building the final products, the simulator code will be stripped automagically.

Another possible reason for this is to have references in "Target Dependencies" to projects for a different platform. In my particular case, I was working on a project that shares code for OSX and iOS. In one of the iOS targets, I had accidentally added an OSX target as dependency.

In order to be thorough, I am posting my solution.
I experienced the exact same problem trying to build an Archive of an iOS project in Xcode 5.1.1 (5B1008). None of the above suggestions fixed the problem, and most of them were irrelevant (I had not added any Frameworks, and did not have any Public entries in the Copy Headers section of my Build Phases).
In my case, fixing the problem consisted of simply closing my project, deleting any archives that I had previously made, going to Preferences > Accounts, removing my developer account, quitting Xcode, relaunching, re-adding my developer account, starting the Archive process again. This fixed my problem immediately.

One more solution, since all the above didn't work for me...
Changed the User Header Search Paths (I suppose Header Search Paths would work just as elegantly) to "$(BUILT_PRODUCTS_DIR)/BlocksKit".
Background:
In BlockKit, the developers have structured the headers in the main project differently than the structure on deployment. So, you can't reference the headers in the project, and must reference the headers copied into the build directory.

The way this worked for me in (Xcode 5) I had 2 targets and when I edited the scheme, on the left pane of the scheme editor, you will see the [BUILD, RUN, TEST, PROFILE XXX.APP, ANALYZE, ARCHIVE] from the BUILD pane, you will see your project targets listed in a list. At the far right end you will see the ARCHIVE selections, make sure only one target is selected for archiving.
I had 2 of my targets selected in my project, I checked only the target I wanted in the product, and it worked!

I solved this error by opening solely the app project in XCode, ie. not opening a workspace comprising the application and other projects/libraries/frameworks.
Having 2 separate project, a framework or shared library and an iOS application, I had to open 2 different XCode windows, each by directly opening the .xcodeproj file instead of the common .xcworkspace, in order to preperly build each.
As a nice side effect, XCode no longer rebuilds every target of every project after I do a Clean, resulting in shorted build times.
Background: I am creating an open source SDK, and a demo iOS application. I had both opened in a single workspace.
Setting Skip install to YES on the SDK targets would prevent anyone from creating an archive, as it would be empty, so this was not an option. Using Project instead of Public headers would lead to an archive missing the header files that should be distributed, so this was not an option either.

For it was because i was working in a workspace.
The project did archived but would ne be displayed in the organizer window.
I closed the workspace and open the project on its own.
The archived has been opened in the organizer ... hope it's help.

In my case, I had a custom script that was copying some temporary files into:
${TARGET_BUILD_DIR}/myTempDir
That meant that, after investigating the archive to inspect its contents, I found right next to the .app file a myTempDir folder. Once I modified the script to save elsewhere things were sorted.

Try setting $(PROJECT_NAME)Headers in Framework projet's Public Headers Folder Path. You have to go to build settings of the Library Target then edit the Public Headers Folder path as $(PROJECT_NAME)Headers.

If using Xcode 7 with cocoapods v.0.38.2. Try removing copy pod resources from your today extension target.

I encountered this problem after adding a OS X command line tool to my iOS app's project, and Skip Install was set to NO by default for the command line tool's target. Since you obviously can't install an OS X binary to an iOS device, archiving defaulted to a generic Xcode archive. Setting Skip Install to YES for this target fixed the problem.

Related

iOS getting stuck at multiple commands found [duplicate]

error: Multiple commands produce '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist':
1) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
2) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Server/Masonry/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
3) Target 'OptimalLive' has process command with input '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist'
Running the code in Xcode 9 works, but there is an error in Xcode 10.
The issue might be occurring because of multiple Plist or other files within App-
Solution -> Open target -> Build phases > Copy Bundle Resources and remove info.plist from there.
Note: If you have developed a watch app too then you will have to remove the plist from the watch and watch-extension too.
This answer is deprecated - Xcode 12 has deprecated the Legacy Build System, it will be removed in a further release
I found the solution for this build error, for anybody else having the same issue with Xcode 10 build system, follow the following steps to fix it:
In Xcode, go to File->Project/Workspace settings.
Change the build system to Legacy Build system.
It will resolve the build issue with the new Xcode 10.
If you want to work with the new build system, then you can find the troubleshooting help from this apple Xcode help page.
Go to Xcode -> File ->Workspace Settings.
You will find one pop up like.
Select "Legacy Build System" from Build System tag.
Press on "Done"
Note:- Make sure clear your project with "cmd+shift+alt+k" and "Derived Data"
Build your project it will work charm :)
I was experimenting with Core Data. I built a data model for a simple checklist program and generated the NSManagedObjects. When I compiled the project I got the following error:
error: Multiple commands produce '/Users/myUSerName/Library/Developer/Xcode/DerivedData/myCoreDateExperiment-gzbslaqdwglkzxemijpdqmizgyzc/Build/Intermediates.noindex/ myCoreDateExperiment /Debug-iphonesimulator/ myCoreDateExperiment.build/Objects-normal/x86_64/CheckListItem+CoreDataProperties.o':
1) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files
2) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files
The problem was the data model (CheckList.xcdatamodeld in my case) was in the "Compile Sources" list. The project compiled cleanly when I removed it from the list.
Open the project navigator and select the project (very first entry at the top)
Select your build target under Targets in the "Projects and Targets" pane
Select Build Phases option near the top
Expand the "Compile Sources" entry and look for your data model name. Search for "xcdatamodeld" if you have trouble finding it.
Delete the model from the compile list
Make sure the data model is included in the "Copy Bundle Resources" list. Add it if it is missing.
EDIT
As #WilliamT. explains in the comments, you need the xcdatamodeld in the compile list. Instead, go to your entities within the xcdatamodeld file. Select the models that are erroring, expand the left panel, and change the field of "Codegen" to "Manual/None".
This answer is deprecated - XCode 12 has deprecated the Legacy Build System, it will be removed in a further release
Try this as well.
Xcode->File->Project Settings-> Build System -> Legacy Build System.
If you are getting this from the Ditto command creating multiple instances of the same name (NOT the 'copy files' build phase), you may have to change the Product Module Name.
Click on your Target(s) Xcode is complaining about
Click on Build Settings
Search for Product Module Name
Change the name to something unique
We have a watch target and a few notification targets in our app, so I just put things like Extension on the end of the module name.
I found this solution originally here: https://forums.developer.apple.com/thread/103913
If you use CocoaPods you may want to try deintegrate the pods and install again. It works for me.
pod deintegrate
pod install
While checking the build log, I noticed a warning:
note: Using new build system
note: Planning build
note: Constructing build description
Build system information
warning: The Copy Bundle Resources build phase contains this target's Info.plist file '/Users/<redacted>/Repositories/Whitesmith/optimize-ios/Carthage/Checkouts/WSStatusBarNotification/Miscellaneous/Info.plist'. (in target 'JDStatusBarNotification')
So, if that's your case then just go to your target:
Build Phases
Copy Bundle Resource
Remove info.plist.
Read this answer if error message references Core Data files
Synopsis: You may have both automatically-generated and manually-generated Core Data managed object class files.
This answer applies if the first line of the error refers to a Foo+CoreDataProperties.o or Foo+CoreDataClass.o file. Example:
error: Multiple commands produce '/Users/me/Library/Developer/Xcode/DerivedData/MyApp-uebslaqdwgldkjemijpdqmizgyzc/Build/Intermediates.noindex/ MyApp /Debug-iphonesimulator/ MyApp.build/Objects-normal/x86_64/Foo+CoreDataProperties.o':
1) Target ' MyApp ' (project ' MyApp ') has compile command for Swift source files
2) Target ' MyApp ' (project ' MyApp ') has compile command for Swift source files
The root cause can be seen by expanding the Compile Swift Source Files section of the Build Transcript. For example:
<unknown>:0: error: filename "Address+CoreDataClass.swift" used twice: '/Users/myUserName/Projects/Jnky/Foo+CoreDataProperties' and '/Users/jk/myUserName/Developer/Xcode/DerivedData/MyApp-uebslaqdwgldkjemijpdqmizgyzc/Build/Intermediates.noindex/MyApp.build/Debug/MyApp.build/DerivedSources/CoreDataGenerated/Jnky/Foo+CoreDataProperties.swift'
The first file mentioned there is a source file in your project directory, which someone generated by selecting your data model in the Project Navigator and clicking in the menu Editor > Create Managed Object Subclass. This feature was added in Xcode 7 or so.
The second file is a file of the same name but which is buried in Xcode's DerivedData. This file is generated automatically by Xcode during every build if the data model (.xcdatamodeld) file is included in the target's Compile Sources build phase. This feature was added in Xcode 9 or so. Zero, one or two files are generated for each entity/class, depending on the setting of the Codegen popup. That popup is in the Data Model Inspector when you select an entity while editing your data model…
The settings are:
Manual/None No files are generated
Category/Extension One file, Foo+CoreDataProperties.m or .swift is generated, containing an Objective-C category or Swift extension.
Class Definition That same Category/Extension file is generated, and in addition a Foo+CoreDataClass.m or .swift is generated, containing class declaration and definition.
So you see the problem occurs when a developer (like me) who is accustomed to the older Xcode begins a project in a newer Xcode. We think that we need to use the Create Managed Object Subclass menu item, which we do, to create the files we can see in the Project Navigator while not realizing that our settings in the Codegen popup are causing Xcode to create duplicate files, which Apple "cleverly" does not show in the Project Navigator, because they don't trust developers to read and heed the comment in the header // This file was automatically generated and should not be edited.
Solution 1 - Use the Older Way
You can disable all automatic Codegen for a data model with just one setting:
Open the problem Target's Build Phases (In Project Navigator, select project, then in list of TARGETS which appears, select the problem target, then tab Build Phases).
Expand the Compile Sources entry and find the problem data model (.xcdatamodeld file).
Delete it from the compile list
Ensure the data model is included in the Copy Bundle Resources list.
Solution 2 - Core Data Magic For Beginners
Here, you go all in on the newer way.
Leave your data model as is in that Compile Sources.
In each Entity Inspector in your data model, set Codegen to Class Definition.
In the Project Navigator, delete and trash any Foo+CoreDataClass files, and rename any Foo+CoreDataProperties.m or .swift files to something like Foo+MyProperties.
In each Foo+MyProperties.m or .swift file, if there are properties generated by Xcode, delete these properties because they will be in the hidden files created by Codegen.
With this solution, your class definitions are generated automatically from the data model on each build. You can't even see them. It is Core Data Magic, nice and simple for beginners.
Solution 3 - For Most Real-World Apps
But Solution 2 is no good if you really want to add non-managed properties. (Objective-C does not allow properties to be added in categories, and Swift does not allow stored properties to be added in extensions.) So in most real-world apps, you probably want to go halfway between Solutions 1 and 2…
Leave your data model in the list of Compile Sources
In each Entity Inspector in your data model, set Codegen to Category/Extension.
In the Project Navigator, delete and trash any Foo+CoreDataClass.m or .swift files, and, to reduce future confusion, rename any Foo+CoreDataProperties.m or .swift files to maybe just Foo.m or .swift.
Ensure that each Foo.m or .swift file contains the class definition, to which you can add your own non-managed properties.
(Acknowledgments to the answer by Positron. My answer here explains why Positron's answer (my Solution 1) works, and adds Solution 2 and Solution 3.)
Solution 1 :
Open target ➼ Build phases ➼ Copy Bundle Resources ➼ remove info.plist from there. ➼ you will have to remove the plist from the Extensions too (if any).
Solution 2:
If you use CocoaPods you may want to try deintegrate the pods and install again.
Commands:
1) pod deintegrate
2) pod install
Solution 3:
In Xcode, go to File ➼ Project/Workspace settings.
➼ Change the build system to Legacy Build system.
I had the same problem, I had a one more helper app in main App and copy this in resource. In my case solved as :-
1) Target -> 2)Build Phases 2) Copy File (n items) 3) Remove Copy File.
The Helper app automatically copied in Xcode 10.0.
Try this Its Working :
In Xcode, go to File->Project/Workspace settings.
Change the build system to Legacy Build system.
None of the solutions proposed here worked for me. This was particularly due to CocoaPods. I was previously using Cocoapods 1.3.1. Simply upgrading to 1.5.3 didn't resolve the issue right away.
The steps I followed were:
Delete Podfile.lock
Delete Pods directory
Delete Derived Data & Clean
Exit Xcode
Update CocoaPods to 1.5.3
Run pod install
Open workspace and build
One option which solved my issue is to changing build system to legacy build system. Please follow the following steps in Xcode 10+.
Here I have written a detailed article on the problem & its solution. Xcode Error: Multiple commands produce
In my case PDFGenerator was producing an info.plist file, I just deleted it.
This answer is deprecated - Xcode 12 has deprecated the Legacy Build System, it will be removed in a further release
I'm using Xcode 11.4
Can't build old project
Xcode => File => Project Settings => Build System => Legacy Build System
Before I begin note that my project utilizes Carthage as a dependency manager.
None of the existing answers here resolved my issue. What did resolve the issue for me was the following.
First, I noticed that the build error pointed out one framework in particular. Next I filtered App Target > Build Phases for that framework. I noticed that that framework was present in both "Link Binary With Libraries" and "Embed Frameworks". Noting that none of the frameworks listed under "Embed Frameworks" were ones managed by Carthage I removed the framework in question from "Embed Frameworks". I then re-built my project and everything works fine including the functionality enabled by the framework in question.
This issue arose for me after adding a second part of the Fabric suite of SDKs to the app.
What actually happened was that the GoogleUtilies Framework was added twice to the Pods project
This would have been fine prior to Xcode 10 but Xcode 10 will complain if a file has two actions against it (in this case a copy action).
It's safe to remove the second framework.
there are some reasons that cause this error to be shown.
1- the project name is the same as a dependency that is used on the project
this error may happen when you choose a name for your project that is the same as one of the dependencies that you use on the project for example you cannot choose FirebaseAuth or GoogleSignIn as the project's name if you use them via pod or SPM.
to solve this problem you should change the project name with the following way:
choose the project from project navigator on the left sidebar, change the project name from the file inspector -> Identity and Type -> name from the right sidebar.
after you change it, XCode asks you to change all relative targets and just press rename.
2 - duplicated info.plist on the Copy Bundle resources portion
you may face this error when info.plist is added to Copy Bundle resources unwanted, choose project form project navigator -> choose target -> goto Build Phases tab -> Copy Bundle Resources and if you see info.plist there, remove it by choose info.plist like the following image
3 - pod files do not work well
sometimes you got this error because the dependencies that you use break for unexpected reasons.
1 - Delete Podfile.lock
2 - Delete Pods directory
3 - Delete Derived Data & Clean (you can find this directory from XCode menu -> Preferences... -> Locations -> Derived Data and go to the directory by clicking the arrow icon at the right of the address)
4 - Exit Xcode
5 - Update CocoaPods with [sudo] gem install cocoapods on mac terminal
6 - goto the project directory on the terminal and run pod install
7 - Open workspace and build
5- duplicated Core data
you may face this problem when you use Core data on the project
first I explain coreData codegen types:
**Class Definition: ** Choose Class Definition when you don’t need to edit the properties or functionality of the managed object subclass and properties files that Core Data generates for you.
Category/Extension: Choose Category/Extension to add additional convenience methods or business logic inside your managed object subclass.
Manual/None: Choose Manual/None to edit the properties in your managed object subclass, for example, to alter access modifiers, and to add additional convenience methods or business logic.
Choose the Manual/None and check if a copy of xcmodeldata is exist on CopyBundleRecources, remove it.
Well, in my case:
If you create two file with same name, will trigger this error.
Remove the one you recently added, will solve this problem.
Hope this helps.
I had this problem when I had a file with the same name in two different targets. For some reason one of those files I had part of both targets. So basically I had two files. And both of those files belonged to one target.
It makes sense that a target can only have one file name per target, so just unchecking the target member box for the file that wasn't related to the main target fixed the issue.
So the problem I was having is that I had accidentally included the Info.plist in the project settings -> Build Phases -> Copy Bundle Resources for my target.
Steps:
Go to Xcode File
Click to WorkSpace Settings
Build System Select as Legacy Build System
Here is another working solution : (If you are using custom Pods)
Select "Pods" from sidebar as highlights in screenshot.
Click on Build Phase. Expand "Headers" section. There are 3 options Public, Private, Project
Expand Public and check there are duplicate files. Remove it. DONE!!
Unfortunately none of these answers worked for me... here was the error I was seeing:
"Multiple commands produce '/Users/.../.../.../Frameworks/abcdef.framework"
That command depends on command ...: script phase ""
That command depends on command ...: script phase ""
Adding this line to the Podfile and doing a " Pod Install " was the ONLY thing that worked.
install! 'cocoapods', :disable_input_output_paths => true
I really hope this helps someone. I spent hours trying to fix this and finally got it.
Sometimes I just wish Xcode was as efficient as IntelliJ / Android Studio :(
Goodluck!
My error was:
duplicate output file
'/Users/home/Library/Developer/Xcode/DerivedData/myAppName-fawptgabysjowicvpeqydjniuovo/Build/Products/Debug-iphoneos/myAppName.app/GoogleMaps.bundle'
on task: PhaseScriptExecution [CP] Copy Pods Resources
/Users/home/Library/Developer/Xcode/DerivedData/myAppName-fawptgabysjowicvpeqydjniuovo/Build/Intermediates.noindex/myAppName.build/Debug-iphoneos/myAppName.build/Script-32CCC25BF727B592A1784900.sh
I focused on the problem file being GoogleMaps.bundle and the location of that file being in [CP] Copy Pods Resources, and the fact that it specified it’s a duplicate output file (I highlighted them in black above), it's the 4th step below
First create a copy of your project and make sure you first do the following steps on that copy
1- In the project navigator I went to the blue project icon
2- I choose Build phases
3- Under Build Phases I choose [CP] Copy Pods Resources
4- Under [CP] Copy Pods Resources I went to Output Files and underneath there I found the file that ended with GoogleMaps.bundle. I selected it and pressed the minus sign to delete it. Make sure you go to Output Files and NOT Input Files
5- I did a clean shift+cmmd+k and afterwards when I built the project the error was gone
The odd thing was even though the red error went away the yellow warning was still there but it worked :)
I had bunch of Multiple commands produce warnings - not limited to info.plist duplication in one target. Including localized resources and string files, headers etc.
Solution: remove all duplications in target membership.
Try all this option anyone of this 3 option will work for you, for sure
Option 1: Remove all files from
Target >> Build Phases >> Compile Sources
Target >> Build Phases >> Copy Bundle Resources
Option 2: Change the build system
Xcode->File->Project Settings-> Build System -> Legacy Build System
Option 3: remove and update existing pod
pod cache clean PromisesObjC
pod cache clean PromisesSwift
cd [your_project_dir]
rm -rf Pods/
rm Podfile.lock
pod update
I hope this will help you, Happy coding :-)
Go in Project Build Phase and Remove info.plist from the Compile Sources. It will remove that issue and project will be active again.
It's worth noting that this error can be produced after auto generation of CoreData models where the Codegen is not set to Manual/None.
To correct this in Xcode 10 double click on your xcdatamodeId file and select each of your entities and set Codegen to Manual/None under Class in your Data Model Inspector.

'Executable path is a directory' Xcode popup error

I have an iOS Xcode project with 3 targets - AppTarget, Lib1 and Lib2.
Hierarchy:
AppTarget is dependent on Lib1 and Lib2. It has no code (SceneDelegate, AppDelegate etc. is moved to Lib1).
Lib1 is a static library containing the AppDelegate and SceneDelegate (Lets not get into why they were moved here from the AppTarget).
Lib2 is a static library, dependent on Lib1. It extends the SceneDelegate class using swift extensions.
In order to get the above structure, I had to add, remove file references and set dependencies.
When I run the AppTarget, I get the following popup after build succeeds,
Pasting the above error as a text,
Details
Executable Path is a Directory
Domain: DVTMachOErrorDomain
Code: 5
Recovery Suggestion: /Users/<user_name>/Library/Developer/Xcode/DerivedData/<project_name>-bnytgzvocmpwyuajjxxjivpkymui/Build/Products/Debug-iphonesimulator/<project_name>.app is not a valid path to an executable file.
User Info: {
DVTErrorCreationDateKey = "2022-11-03 08:04:49 +0000";
}
I'm not sure why this happened. I didn't mess with the default executable path in Xcode->Preferences->Location tab.
There's an Apple forum post which describes a similar error (not the same).
The solution was to check for references of old files, which are not present now. I have verified the Target->Build Phases->Compile Sources of all 3 targets and things are as expected....Didn't see any 'faint files'.
What am I missing here? Any help will be greatly appreciated.
I'm using Xcode 14.0.1 and swift 5+.
One of the reasons for this can be if there are no sources in the app target. If there is no code, the executable does not get generated as expected. See if adding a dummy/sample source code works i.e. Just a swift file with an empty class should also do the trick.
What worked for me:
Delete app from simulator
Delete DerivedData folder -> ~/Xcode/DerivedData
Quit Xcode
Restart computer
Launch Xcode, clean project (command + k), clean build folder (shift+command+k)
From there I was able to run my app target successfully ✅
Exclude the arm64 arch when building for the Simulator. The reason is the Simulator is using X86 based architecture. When building for a real device, like an iPhone, you must remove the Architecture exclusion. The iPhone is using arm based arch.
See the snapshot here

Xcode picks up wrong info.plist file when generating the .app file

I have a unique issue, where Xcode picks up the wrong info.plist file when compiling. I have two targets, one is in the release version and the other is in the beta configuration(scheme). We have different files in the app bundle, which are used based on the target and also the build configuration.
When I am running the beta configuration, it runs fine, but when I try to run the release version of the application, xcode still picks up the beta build configurations.
I have tried various ways to change the plist file, deleted the files,added them again, edited the build phases, edited the build settings in the copy bundle resources. Closed xcode and also the simulators. I donot know what I am missing in these.
I have also made sure only one info.plist file is associated with one target. The targets shows the correct info while checking, can you please help me with this. The problem occurred during merging of two code versions.
Update:
I went ahead and deleted the info.plist file, which shows up in both the targets, but all I receive is an error while compiling info.plist utility error. It is pointing the plist file, which I deleted. The info, build settings, show the correct plist files
Update 2
I went ahead and also changed the files, changed build settings, packaging files, but still the target picks up the other file. Any way to fix this?
It happened to me today and at nothing written here helped
the settings ARE ok but resetting it didn't help
the cache cleaning didn't help
BUT what helped is:
recreating the scheme with 100% the same settings :) it works fine now
You don't have to clear any cache, just edit the scheme of the new target and change the run executable in the info tab to the new executable target.
I have fixed this problem by using the plist file irrespective of the configuration. So, irrespective of the target if a corresponding scheme had beta configuration I will use one plist file, if the other target is the release version so I will use another plist file.

iPhone App Submitting - Error ITMS-90171 Invalid Bundle Structure Can't Contain Standalone Executables

I've included screenshots of the full error messages I'm getting. This happens when I try and submit my app to iTunes Connect. I don't get any errors when running the app.
This issue for me was caused by including the framework in the bundle. Ie, I was copying the .framework file into the app bundle. This isn't necessary as the framework is statically linked against the main app binary.
Most likely, you have a folder containing the .framework that you copied into your project (like an "external" or "ThirdParty"). That folder should not have membership to any target.
In your Frameworks folder itself, should be the actual .framework file with target membership for your app and "Required"
I had the exact same error for my application, and I was not able to find any reason from the information. The difference was, though, that I got it for all my .dll files.
After some time, I saw that under IOS Bundle Signing - Custom entitlements it tried to point to a file that did not exist. I just removed that, and it stopped giving errors.
Not sure if it helps you too, but it worked for me.
What helped me, that I made my framework in the Target of a project in the Framework, Libraries and Embedded Content -> Do not Embed.
I too faced same issue,
Step 1: See while copying .Framework you had wrongly copied(dragged) the framework in GoogleMaps.bundle or some other .bundle extension.
Step 2: If some other framework is present in .bundle resource, if present then remove that framework if not at all required, else drag out of that .bundle.
Step 3: If .framework is not present, then check in all .bundle resource, if .framework is being present, if present then remove that framework if not at all required, else drag out of that .bundle.
Step 4: Then clean and build the project.
Not sure, if it helps you too, but it worked for me.
our bundle had a special character with an accent, removing that fixed the problem.
What worked for me was using the XCode auto-update settings for the project in the show issues navigator. When I updated 2 settings from there the project build successfully and even uploaded to the TestFlight.
I just experienced this in Xcode 13. We have some of our Swift code in separate modules (separate targets in the Xcode project), and one of those targets referenced a couple other modules in the same project. It had them set to "Embed & Sign" in the target General Info tab. I set that to "Do Not Embed."
But that was only part of the solution. I got a complaint about "There is more than one bundle with the CFBundleIdentifier value under the iOS application . With error code STATE_ERROR.VALIDATION_ERROR.90685"
The solution to this was to create a Framework target in Xcode, move all the shared (static) SPM dependencies to that, remove them from any other targets, and then add the new framework to the targets that need them, being sure to select "Do Not Embed."

Xcode has started making archives, not apps. How do I change it back?

Im' writing an phone app in Xcode 4.2. At some point in the last few days, I changed something - I don't know what, and there's nothing obvious in the git history - and although I can still run it on my device and in the simulator, when I archive the build it makes an archive instead of an app. I can't share these archives as IPA files; if I try I get told "No packager exists for this type of archive".
What did I do? How do I change it back so I can produce IPAs again?
I did the following to make it work for me:
for the three20 static library, I used cocoapods to include the files within the main project.. it just got rid of all the trouble three20 was giving me (and they are lots..) btw i tried replacing three20 with Nimbus.. but Nimbus was lacking on some of the features that my project was using three20 for.. so Nimbus wasn't helpful.
set skip install to yes under build settings for all other sub projects/static libraries and switched the copy headers from public to project under build phases
most importantly: under the sub libraries.. under build phases i ensured that copy files destination was changed from Absolute path to products directory.
and that was it!
hint: to get an idea of the offending files that's causing your archive to create an archive file rather than an ipa do this:
Select the archive and click the Distribute button.
Select the 'Save Built Products' option.
Hit Next and Save.
Browse the created directory in Finder.
The 'libraries' subdirectory will identify the libraries that you need to set the Skip Install to Yes.
in some cases usr/local/include will identify the culprit header files you need to move from Public to Project or the files that you have to change from absolute path to products directory. but that directory (ie usr/local/include) varies depending on your sublibrary directory structure
Make sure for any intermediate targets you select "Skip Install" for its build settings.
Click ont the build dropdown in the top-right of your Xcode window and select "edit scheme" and see if anything is wrong there.
If you can't see anything, try selecting "manage schemes" then delete your old schemes and press "autocreate schemes now" to make a new one.
You only want one scheme, for your app build (or one for each target if there are multiple targets). If there are other schemes (e.g. for embedded sub projects used to create static libraries used by your project) delete them.
Also, as jrtc27 says, if you have got any sub-projects that produce static libs, you need to mark them as "skip install" in the build settings. There's another question here that relates specifically to that issue and has a more detailed explanation of how to fix it:

Resources