Thoroughly Cleaning Out App Data for Clean Build? - ios

I have never had a problem like this but its clear a thorough clean out of all app data related to my project needs to be done as I am getting a crash related to UICollectionView which I have no removed any reference to in its entirety. I have tested the build on the simulator after resting its contents and it runs without the crash.
For building to my iPhone, I have deleted the app, restarted my iPhone, cleaned the project in Xcode, quit Xcode, restarted my computer and re-built and run. However my iPhone seems to be remembering something from that old build, resulting in this error to still be prevelent.
So how can I truly once and for all (without restoring my bleeding iPhone) clean out any old data related to my Xcode build?
Thanks.

Deleting the app on your phone should be sufficient. Your phone will not "remember" the app, as you suggest it might be. The only thing an app can physically leave behind after being deleted is anything that it put into the Keychain, such as a username/password that was saved there. Other than that, nothing can be left behind after an app deletion (at least not for practical purposes, I'm not trying to claim that iOS zeroes out the bits).
That said, obviously do a clean in Xcode and then delete your derived data. For full instructions on doing a complete clean, see the answer to the following question: How to Empty Caches and Clean All Targets Xcode 4

Have you tried deleting the Derived Data in Organizer? Press Command-Shift-2 and go to the Projects tab. Under your projects you should see a long path to Derived Data. Delete that, restart your computer, and let Xcode reindex your project. Link to a screenshot

Related

Why Xcode shows "This app could not be installed at this time." pop-up?

When I run the project and add the app in simulator for the first time, everything is okay. But when I run it again, Xcode prompts this message as a pop-up window at the end of compilation:
This app could not be installed at this time.
I already checked the relevant question, and tried all the advised ways to solve this issue; checking mentioned logs, cleaning project, restarting simulator, changing it, erasing all content and settings in it. Nothing works. I must erase the app and recompile it every time to open the app. Did you get the same message before? Is there any way to detect problem and resolve it? Btw, I use Xcode 9.2 at High Sierra.
This error pop-up may come up for different reasons. There is no specific reason to see it for now. In my case, a JSON file that I added to Bundle in order to provide mock data triggered this issue. This file was containing a Turkish letter in one of the keys. After I fix it, the pop-up is gone. Interestingly, earlier simulators (<=9.1) work properly if JSON file contains Turkish letter but 9.2 simulators cannot tolerate it.
Worked for me when I rebuild the project after deleting the derived data folder.
I think I may have found a solution. This all started a short time after I let Xcode update my project settings. Specifically on my CocoaPod-Subproject. I removed the pods and reinstalled them and now I am no longer getting the pop-up.

"No space left on device" error when compiling

In Xcode, when I tried to run my app on my device (iPhone), I get "no space left on device". The app was working on iPhone yesterday, but today I got this error.
Anyone know how to fix this problem?
There are two common steps to this fairly common issue:
Delete the app from your device.
command+k which will clean your code and run again.
OR
Close Xcode and reopen, run again.
Ensure you delete the app from your device first. If necessary, turn your phone off and on again, but I have never had to do this after erasing the app from the device and reinstalling.
Maybe need to check storage on your Mac. I have the same problem with Xcode8.3.2 with 2Gb available of SSD on MacBook, after delete somethings then it worked.
Do Product -> clean. Then delete everything from DerivedData folder and empty trash.
To restore some bulk space back, delete some of the simulators and
build archives that you don't need..
Goto Xcode -> Window -> Devices & Simulators -> Right click and delete some simulators that you won't need for testing..
Also Xcode -> Window -> Organizer. Tap archives and select projects from drop down and remove all archives of builds that you won't need anymore. Usually you won't need them because you would have already generated ipa from them and would many GBs of space and this issue will be solved. It worked for me.
I am currently seeing this error message ("No space left on device") when creating named semaphores using sem_open(). (A Unix function call) The error message text is returned by a function called errno(), the result of which I write to the console when sem_open fails.
It sounds to me like some code you are using is attempting to create a semaphore and getting this error. It's my understanding that this happens when you create too many named semaphores without freeing them (They persist between runs of your program.) You will probably solve the problem temporarily by rebooting your phone.
The same message may well be displayed by other system functions, not just sem_open. You might try setting a symbolic breakpoint on errno() and seeing if you can find the code that is generating the error message.
If anyone have issue on Mac or windows emulator and not on actual device than please open the disk on which your project code is and check that disk size and not your primary application disk size, you will need space on that disk too which had your project code, I did this and it just worked fine after that.
I encountered this error when building the app in iOS Simulator. I realized that my Mac's storage was full. So, I freed up some space of about 10 GB, and the rebuild was successful.
Check you hard disk, if its full then delete some unwanted data build and run. It worked for me.
please free up the memory of your mac machine and try build it will work.
I checked the storage on both iPhone and Mac, there was a lot available.
Logout and re-login made the problem go away (I didn't delete the app from the iPhone).

Storyboard won't update in simulator

I have a working app in Xcode, however when I try to build and run it the simulator displays an older version of the storyboard I was working on. I had changed some of the design on the storyboard but this does not reflect in the simulator, nothing is updated.
Does anyone have any ideas?
Delete the App on the simulator.
Clean
List item
Build & Run
Use NSLog(#"") in your controller to check code execution.
I just spent at least 6 hours on this. I have a solution, but I also submitted a technical support ticket to apple to try to get more info on the cause and proper solution.
Simply remove the references to your storyboard files and add them back in the same file group.
This seems to include the storyboard files back into the app bundle generated during build(which can be seen in the
DerivedData/APPNAME/Build/Products/Debug-iphonesimultator/APPNAME.app
From here I can see my changes reflected from the storyboards as expected.
PS - Are you using localization at all? I was.
I lost 2 hours to this.
Solution was braindead simple: delete app, turn OFF the iPhone 5S (iOS 7.1.1), and turn it bavk on.
When you turn on localization,
xcode moves storyboard file in localization folder (ex. Base.lproj/name.storyboard). When you build and run project on simulator, xcode copy name.storyboard into "derivedData"/Base.lproj/name.storyboard, but previous, created before localization "derivedData"/name.storyboard still exists. In this case simulator uses the file which can be found easier, i.e simulator uses old file "derivedData"/name.storyboard to operate.
Solution: Just rename the storyboard file, in navigator and in targets/general.
This error happened to me for the first time when I had multiple copies of a project on my computer. For whatever reason, the fact that there were multiple copies were making it look as if the storyboard had not been updated between copies and in some cases the code was not updated. I thought I had forgotten to throw the right copy on my flash drive before going home, but it turned out it's an XCode error.
Delete any multiple copies using the same name, restart XCode and open your most recent copy. Extremely bizarre, but I will probably use BitBucket or GitHub from now on instead of throwing it on a flash drive.
Deleting
~/Library/Developer/Xcode/derivedData/
worked for me!
I just have the same problem after localizationMy solution is clicking Product, Clean build folder. Then it will be fine
The storyboard on the simulator was what it should have been. The storyboard on the device would not update. I had to delete the application from the iPhone and then re-run it on the device in order to get the Storyboard to update on the device. Fortunately for me it was only test data, but I was using Auto-Layout on one view and went back to manual. I think that's what caused the issue for me.
I find that removing and adding storyboard file back doesn't work in my case, also it has side effects like it will automatically add a main nib entry into App's plist file (which subsequently makes the App fails to launch in iPhone simulator).
I don't want to try to delete the application from the simulator since I have many files under the Document directory of the App.
At last I find another way that works well: simply delete the "/Users/$username/Library/Application Support/iPhone Simulator/7.1/Applications/$app/$yourapp.app" file. The files under Documents directory are untouched.
(I have localized my storyboard as well.)
I found this same thing happened with Xcode 6.1.1 if I happened to have copied a project; the new project run in the simulator was actually still reflecting the old, original project.
In my case the problem was with how the default area was set up for derived data (essentially the location where the binary files go for a build). Mine was set to legacy and the simulator was using the wrong project, even after a clean. The solution was to go to Preferences->Locations, press Advanced, and change the location from Legacy to Unique.
I get this too when using localized storyboards - Run in Xcode just refuses to install the latest version of the compiled storyboard. I think it is something to do with the way Run copies changed resources across to the device - it does it differently than other forms of on device app installation.
The quickest way to get past this without deleting the app and losing any data is to:
Generate an Archive build in Xcode
Export this for Adhoc deployment
Double-click on the generated IPA to add it to iTunes
From the device page in iTunes force an update to that app
In order for iTunes to see that you have a new version your app build number will need to be incremented (if you don't do that already), before generating the archive.
I find this method means you don't have to delete an app off the device, you're just forcing it to install the entire install package rather than a diff which is what I think Run is doing.
I'm not sure what causes this, if it is a localized resources bug or what, but this is still a problem in Xcode 7 for me.

How to restore my project wisely

So, it started as a simple test, where I had to delete my app from my iPhone (iOS4.3) just to check how the app behaves on a first run. (I am developing to support down to iOS4.3).
After the deletion, I wasn't able to run the app on my iPhone for some reason. The "Active Scheme" would show iOS Device, although I could manually select my own device from the list, the project wouldn't set my device by default. XCode would drop a message from the top saying:
Could not launch “project1” No such file or directory
(/Users/portal/Library/Developer/Xcode/DerivedData/project1-
cfjhjgezzcapwoadaivpptyywptu/Build/Products/Debug-iphoneos/project1.app/project
I went through this SO post (EDIT: Therefore, restarting XCode, iPhone doing clean project, hard resetting my iPhone) but this didn't change anything, except I can now delete the Derived data in Organizer.
I have a working backup at hand though. Thing is it is a bit outdated as I made many changes to the project. I can run the backed up project, and it seems sane as good.
Now my question is how can I merge the files back into the sane project? The XCode project itself has changed a bit, frameworks were put in as well as some settings.
I tried to simply copy the changed files into the old project, but all I get is a SIGABRT upon the first run. I did a FileMerge look, and saw that for some reason my projectAppDelegate.m is non existant in the PBXBuild section of the .xcodeproj file. which I didn't touch. seems like a mess here.
How can I merge the new project to the old one correctly?

Xcode Build and Archive for Enterprise Distribution builds old archive

I'm working on creating an app for in house distribution enterprise level. I've created the app and tested hosting it on my own server and even getting the click to install working. Now though I have some updates to the app, I make the edits and I even see them in the simulator. When I build and archive the app things seem fine, then I go to the archived project in the organizer window, click the share button and distribute for enterprise, I enter details such as the ipa final url and the app title and then ok & save. Then I upload the app to my server and update any links to point to this new app. The click to install still works properly, but it installs the old version of the app. I've even tried this on a new device. Is there some step I'm mission that tells Xcode some version to build? If so, I don't get is how the simulator shows the update fine, but the archive that is built is not showing the latest code. The app I can find in the simulator dirs is 9.4MB in file size, but the one that is saved after build and archive is only 1.4MB (the update involves a lot of added images), so is the build for archive is not even getting the new files?
if a clean won't work, try completely removing the derived data folder.
the default location is in /Users/you/Library/Developer/Xcode/DerivedData . if you haven't played with the DerivedData location in preferences, this is likely where you'll find the sub-folder containing the cache.
when i encounter a situation similar to the original question (retaining items i've deleted, or similarly missing items i've added or holding onto project icons i've changed), i perform a clean on my project, close it, hit Delete… in the organizer, possibly even remove it from the organizer, possibly even remove from disk and then re-checkout from git if you have it under version control in this way, then re-open the project from scratch.
I figured it out and thought I should post it in case it helped someone else.
I cleaned the project.
Build > Clean - not 100% on what "Clean" is supposed to mean/do, but it allowed the project to build from the current files rather than the old files somehow.

Resources