How can I clean xcode build cache? - ios

Any change I do in Xcode, build successfully but when I review it in simulator or transfer it to my iPhone, the previous successful build which was sent to the store is running.
It was a working application with history of changes in app store, then I decided to change the name and unique identifier. All went well and I was able to deploy first changes to the store, after that xcode started to show this odd behavior. I made changes, built successfully but the previous version showed up in simulator etc.
Then I found a silly workaround, every change I made, I rebuilt the environment by pull the code from my repo and
#cordova add platform ios#4.5.4
#pod update
#pod setup
#pod install
Then open the Xcode and built the project, then everything was as expected.
but unfortunately this trick stopped working as well and I stuck.
I do clean
I do clear DerivedData folder
I do use "watchdog" application to do cleaning
Did I miss anything?

How to clear Xcode cache manually
1. Clean the build
Tip: If you’re trying to fix a problem with Xcode crashing, it’s worth cleaning the project build first. This will get rid of the current build and create a new one next time you run the code.
With the project open in code, go to the menu bar, choose Product, and select Clean or:
With the project open, press Command + Shift + K.
2. Clean out the build folder
To clean out the build folder, and get rid of cache files, do the following:
In the Code project, click on the Product menu while holding down the Option (Alt) key and choose Clean build folder, or:
Press Command + Shift + Option + K.
3. Reset Simulator content and settings
If neither of the steps above resolves your problem, try resetting the simulator content and settings:
Go to the menu and choose iOS Simulator, then click Reset Content and Settings.
4. Delete derived data
If you’re still having problems, try deleting derived data, which will force Xcode to recreate it when you next run it.
In the menu, choose Window, then Organizer.
Now select Projects, and then click Select your project.
Choose the project whose derived data you want to delete.
In the window that opens, you’ll see see the Derived Data folder listed, along with its Finder path.
To the right of the folder, there’s a Delete button. Press it.
Now, delete the module cache.
Go to: ~/Library/Developer/Xcode/DerivedData/ModuleCache.
Drag the files from the ModuleCache folder to the Trash and empty it.
Source: https://macpaw.com/how-to/clear-xcode-cache

For my case, it turned out to rebuild the whole environment to get it fixed.
One basic point that needs to be highlighted is using "cordova prepare" after any changes.

Related

iOS Asset/Storyboards not updating unless a "Clean Build" Swift package manager, Xcode, Storyboards, iOS

TLDR;
Assets(storyboards, images) not updating unless clean build with Swift package manager local dependency.
Explanation:
I use Swift package manager and have a local dependency (module) that has storyboards, image assets etc. However, if I make any change on them and just cmd+r to run the app, changes are not shown; for example, if I change label text on the storyboard, it won't show the updated text if I just run cmd+r.
To make them appear, I have to clean the build folder and re-run the app again.
But if I change any swift file it works fine.
Try just going to file>Packages>Update Packages To Latest Version
I had a similar behavior with one of my projects. Changes to the storyboard wouldn't be reflected in the simulator if I chose the new build system.
I know that the legacy build system is now deprecated, but you can still try to build with it and see if it is a bug of the new build system.
File > Project settings (or Workspace settings) > Build System > Legacy Build System
Try Updating the packages and also delete your derived Data and archives and give it a go. Seems more of a Xcode bug /cashe issue . Are you using Xcode 13?
It's difficult to find the exact reason because it could depend on several factors. When you open your storyboard file, go to Editor->Automatically Refresh Designable Views and be sure it's checked.
Check also Xcode->Preferences->General->Issues and be sure the check below called "Show Live Issues" is flagged as this picture:
Another reason about your assets refresh failure could depend by the missing resources inside the list: Targets->Build Phases->Copy Bundle Resources
Check also if your resources are shared with a file hosting service like Dropbox, it could be have a local cache which keeps the old version.

Files are not in project navigator eventhough project compiles and can search for them

The problem started when I got into the project and saw I have no scheme. Couldn't create new scheme except for the cocoa-pods target. Then I went into my project via finder, and noticed that the project was backedup into the iCloud, and when downloaded it it appeared in the schemes and ran fine.
So I am with this project for a while now, started it in xcode 9 and already released a few versions to the store. Today I open the project for more developing, and I notice that I cannot see the files in the navigator. If I search for them I can go into them and edit. If I am running it, it builds and runs perfectly. Only problem is that I cannot navigate between files, and cannot find the storyboard in the search, so cannot open it at all.
I tried -
Hard clean
Delete derived data
reset computer and xcode.
But still cannot see the files in navigator.
Screen shot of navigator added:
As per our discussion in comments above I am adding the comment as answer, you can try deleting the xcuserdata folder inside .xcodeproj and re-run the pod install to solve the problem.
In order to do that, go to your .xcodeproj right click and select show package contents
Once it opens the finder window with contents inside it, simply delete the xcuserdata folder
Now get back to your project root folder in terminal and run pod install once done open the project using workspace.
That should solve your problem :)
Happy coding:)

Xcode won't remove Derived Files

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.

How to solve the apple LLVM 5.0 error in xcode 5?

I was running my application without any problems on both the simulator and device. All of a sudden i get this error:
fatal error: file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UICollectionView.h' has been modified since the precompiled header '/Users/rashidasgari/Library/Developer/Xcode/DerivedData/ModuleCache/SWBH8ZAWBXAH/UIKit.pcm' was built
note: after modifying system headers, please delete the module cache at '/Users/rashidasgari/Library/Developer/Xcode/DerivedData/ModuleCache/SWBH8ZAWBXAH'
I tried any solution i could find and still no luck. Note that i tried running the application on another MacBook and everything works fine without any errors.
Cleaning the project is the first port of call (menu under Product).
If that doesn't help, delete the derived data. That can be done via the Locations section of the preferences or by navigating to the directory in Finder and deleting it (there is a little -> button in preferences to get there, or use Go To Folder... option in the Finder.
Ok after trying almost every solution on web, i decided to reinstall xcode and it finally worked.
I solved this problem by changing DerivedData folder name..see how i did
Xcode->preferences->Then you will be redirected to preferences screen
Then click on locations tab under menu selection->then you will have options like Derived data,snap shots ,archives
under Derived data you can see some thing like /Users/SENABI/Library/Developer/Xcode/DerivedData-> then click on that arrow button that's it there you can see DerivedData folder click on that and rename it. your error will be removed.
This is my experience and it worked for me hope it will be helpful to someone.
Error occurs when system header files are modified.
Solution :
If you have the backup of XCode then reinstall the XCode (Better solution).
Delete the DerivedData folder and then build the project
Use CMD+Shift+K to clean the build and then relaunch. This should solve the issue.
you don't have to delete anything.
you messed up a git pull somewhere probably. just quit Xcode and the simulator, reset any changes (or stash them) try another git pull, start Xcode again, clean your project and run it again.

I need to run XCode 4.3 project twice in order to launch the cocos2d application

it drives me crazy, that my cocos2d project runs every second time on the device.
Every other time it says "Finished running " without launching the application.
My os version is 10.7.3 and I run xCode 4.3.
Other projects seems to work fine.
Any ideas?
BR,
Marcin
There were two Info.plist files under Resources folder. One of them was also under Copy bundle Resources tab in Build Phases section of the target.
I don't know how this happen, however I deleted one of the plist files, then removed it from the Copy Bundle Resources tab and now the project runs every time.
I found the second file while I was inspecting the whole project file by file. XCode does not report, that something goes wrong. I simply saw two files with the same name in Project Navigator pane.
Okay, I found a way to automatically do this.
Click the project icon, go to target, go to Build Phases tab, and at the bottom you should find the Validate Settings button. Click it. A window will show with an option to clean the "multiple references" of a resource. Use that, and XCode will do the rest.

Resources