Difference xcode to perform clean and remove the DerivedData?
The more detailed the better.
Clean menu cleans up the directory for all targets by deleting the app and dSYM files with the precompiled headers.
Derived data contains symbol indexes, build products, window layouts of respective app. After deleting DerivedData Xcode has to recreate indexes for your sources, so it becomes slower at times.
Refer this link for detailed explanation : http://useyourloaf.com/blog/xcode-4-deriveddata-and-cleaning-the-build-directory/
Related
When I checked my app size its going approx 120MB right now. Out of which mostly was taken my extra resources. Later on I removed all extras and added compressed version of launch images also 2 extra pods. All this reduced my app size my 30 MB. But still When I checked my .app package contents its showing some extra LaunchImages which I may have added earlier and are still somehow connected to my code. I am unable to find out their source. Please help me how to remove these extra linked images from my code.
Delete unwanted file from bundle resources
Go to your Project settings
Select your application target under Targets
Select the Build Phases Tab
Expand the step Copy Bundle Resources
Remove and unwanted Files that shall not be copied into your bundle
Delete unwanted file from Assets.xcassets
Also, check if your project contains an Assets.xcassets assets library and look if you find your unwanted image within.
Sanity check
When sometimes everything you try fails and Xcode behaves strangely, make sure your problem is not already fixend and only caused by cached resources.
As sanity check you can
Clean Build (Product -> Clean)
Delete Derived Data (Delete ~/Library/Developer/Xcode/DerivedData folder in Finder or via Terminal command rm -rf ~/Library/Developer/Xcode/DerivedData)
Remove App from Device by long-pressing and deleting.
Afterwards build your app again and check if the problem persists.
Remove the items from Assets catalog if it is an image.
Remove unwanted files from respective directories.
Remove the Derive Data.
Clean the project. Then archive.
How to remove Derive Data:
Xcode-> Prefrences-> Locations-> Derive Data.
Remove content of Derive Data folder.
iOS 9 has got a new feature called App thinning. Xcode and Appstore handles downloading of images that are relevant to specific iPhones thereby reducing the size of the app. You can just enable App thinning while moving your App to the Appstore. This is one of the method to reduce your app size.
you can check this App thinning
DerivedData keeps returning into my project no matter how many different ways I try to delete it. This is causing a compile error.
I believe it is related to my deletion of my Core Data model class and extension (I realized I needed to add an additional property and this seemed easier than migrating since I hadn't actually implemented it yet). I deleted the files and removed the reference to these files, but that seems to have not worked. This is the error I've received:
I have tried:
-Cleaning
-Cleaning Build Folder
-Resetting Simulator Content and Settings
-Removing the DerivedData folder using "git rm -rf --cached ."
-Deleting DerivedData folder using Finder, Xcode and Terminal
-Deleting the Module Cache
-Deleting Xcode preferences (defaults delete com.apple.dt.Xcode)
-All of the above combined with quitting Xcode and/or restarting my computer
-Following all suggestions in the following threads on SO:
Xcode 6 Swift code completion not working
How can I delete derived data in Xcode 8?
Xcode keeps remaking derived data folder after I delete it
https://forums.developer.apple.com/thread/81265
https://iosdevcenters.blogspot.com/2015/12/how-to-delete-derived-data-and-clean.html
For the sheer hilariousness of it all, I have my project folder open in Finder when I try to run the project and can see the DerivedData folder being created as soon as I press the play button. Good times.
This is a view of my build/compile settings in Xcode to show that I don't have those files listed twice:
How can I fix this?
The error suggests that you have Core Data code generation turned on and also have a copy of the generated code (or at least a file with the same name) in your source code repository. That's why it complains of a duplicate. One is located in your Model folder, and the generated copy is located in derived data.
You can resolve this by either
Changing the setting in your data model so that Core Data doesn't generate code for this entity anymore, or
Deleting your copy and letting Core Data do its thing.
Either is valid and should work. Or, if the files are actually different in some meaningful way, rename yours so that the name doesn't conflict.
On a related note, the derived data folder always comes back because that's where Xcode puts all of the stuff it generates while compiling your project. It's not just generated source code, it's also things like compiled object code files and eventually the app itself. It comes back because that's how Xcode compiles the project.
You can't prevent Xcode from generating derived data for your project. No matter how many times you delete the folder, it will always regenerate.
I've come across similar issues in the past where the compile time error points to derived data, but something else is causing the issue.
From the looks of it, some of your files are being included twice in your project, and your getting name collisions. Check that you don't have duplicates in you build settings for bundled/compiled resources.
I need to figure out why it is that Xcode, suddenly and with no provocation, starts handing me this error and not allowing me to build my project. When I say, "without provocation", I mean I'm editing text in the database the app delivers text from, and checking my progress in the simulator, doing nothing in Xcode at all except cleaning, building and testing. Everything will be fine for several test sequences, then suddenly, changing nothing in my procedures, the app won't build and I get these errors:
error: remove
/Users/casey-cayce/Library/Developer/Xcode/DerivedData/PEM-LTE-2016-gyoajgqmkkoluhgbrhjmgwakiejl/Build/Products/Debug-iphonesimulator/Living
the Eucharist.app/images: Directory not empty
error: couldn't remove
'/Users/casey-cayce/Library/Developer/Xcode/DerivedData/PEM-LTE-2016-gyoajgqmkkoluhgbrhjmgwakiejl/Build/Products/Debug-iphonesimulator/Living
the Eucharist.app/images' after command failed: Directory not empty
I've gone to this Derived Data folder and physically deleted the contents, only to have Xcode restore those contents when I reopen the app, fail the build, then give me the same errors over again. My only solution so far is to completely delete Xcode and the Developer folder, reinstall Xcode, after which it behaves fora little while, but will eventually do the same thing again. I've done this 3 times so far today.
If anyone has any suggestions, please help me get this resolved so I can get this project exported and finished.
Thanks.
Additional info in response to responses:
I have:
1: Closed the project.
2: Opened the Projects, folder and deleted the Derived Data, seen the Projects folder go blank (empty) with "No Projects" showing in the window.
3: Made sure the trash is emptied.
4: Run "WatchDog," an app developed specifically for dealing with Derived Data issues in XCode.
5: Closed Xcode & re-opened.
6: Opened the project, cleaned, and run the Build command.
After all that, the same errors come up again.
Check your "Copy Bundle Resources" in Build Phase, You should find some files(should be images in your situation) in that list twice. Delete them and rebuild.
It is ok to delete DerivedData folder, you can delete all files from DerivedData sub-folder (Not DerivedData Folder) directly.
That should not take any effect. Contents of DerivedData folder is generated during the build time and you can delete them if you want. It's not a issue.
All contents of DerivedData will be recreated when you build your projects again.
I suggest you clean project project and build again, ALSO PLEAE MAKE SURE YOUR DELETED DerivedData folder is not in BIN please clean trash, it is important
In Xcode go to Window > Projects, select your project and there will be the delete button to delete the derived data.
As of Xcode 9/10 you'll be able to access the Derived Data folder by navigating to
File -> Project Settings
or if you use a Workspace:
File -> Workspace Settings
And press the arrow behind the path:
Go to the folder and delete the derived data
Add this to your shell and it will remove the DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData/*
It's not the best option, but helps me a lot of times - create new project and drag all source files from current in to new one.
I found the source folder for architecture i386, by copying the path specified by the error message in Xcode. There were several .o files which apparently were conflicting, however whenever I deleted one, and ran the program, it would replace it. What do I do? Also I've cleaned it and closed everything and restarted my computer. Thanks
The .o files are just the compiled versions of your source code, which is where the conflicts really lie. What you have is several things named the same thing, and the linker is stressing out over it. Take one of the error messages, you'll probably identify the name it says is conflicting (not the file, the symbol), it might have extra padded symbols, but you should recognize a method name or variable name that you used. Search for that in Xcode, and see where you're defining it more than once. A symbol can have only one definition, so if you're using it in multiple cases, you need to resolve that.
Possible Issue
This problem usually happens when you import .h files to Compile Sources.
Possible solution
Steps to clean project
Click on your project
Select target of your project
Go to Build Phases
Expand Compile Sources
Remove all files there
Steps to configure it again
On Compile Sources click + to add files again
Highlight .m on search
Add all .m files to your project
Clean project by going to Product->Clean on XCode Menu
Click run, and hope it will work!
What is the actual difference between both these actions?
I ask because I find cleaning (Cmd-Shift-K) a slow, time taking process, and deleting the whole DerivedData folder much more faster.
More Info
1) I have set my DerivedData folder to be in a relative folder to my project folder in the XCode preferences.
2) I usually deal with projects with only one target. Very rarely I have to deal with 2 or more targets.
This is explained in Use Your Loaf's article on Xcode 4 DerivedData and Cleaning the Build Directory.
In Xcode 4 the Product > Clean menu option cleans up the build directory for all targets by deleting the app and dSYM files along with the precompiled headers.
DerivedData on the other hand contains other stuff:
Each workspace gets a unique set of symbol indexes, build products, window layouts, etc., otherwise referred to by Xcode as derived data.
So, the answer if you want to really clean everything, is to use the new Xcode 4 Clean Build Folder action by selecting the Product menu whilst holding the Option key. That will also delete the DerivedData contents:
Clean is slower, because it deletes file by file, not whole folder
After deleting DerivedData folder you'll get some slowdown, because XCode has to recreate indexes for your sources.
There is 'Clean Build Folder...' command (Option-Cmd-Shift-K, or select Product menu and press Option button). It removes folders not files, so it can be faster for you.