XCode: Still Able To Access Deleted .plist Files...Why? - xcode

I noticed something odd today. I have an application that writes/read data to a .plist file, and when I deleted that file and left all my code in my implementation file the same, I ran the application in the simulator and it was still able to read/write data to this deleted file.
However, if I try to read data from this deleted file in another view controller, they cannot find it. Very very strange.
Is this a known issue in Xcode, or is there something I am probably doing wrong?
If I need to provide some sample code I will, just let me know.

The simulator loves to do this kind of thing, Try clicking "Reset Content and Settings" in the simulator, and cleaning targets in Xcode command-shift-K. Now if that doesn't completely do it you may have to restart Xcode. Another thing I've noticed when working with a .plist is that sometimes if the .plist is deleted and the code is intact, when you execute a write command it has created to the .plist file to write to.
EDIT:

Related

SceneKit: imported dae file not copied to app bundle

Got a weird scenekit asset problem... I’ve got an assets file (catalog.scnassets) that seems to be fine in Xcode. I’ve added to it a dae file which also opens fine in Xcode.
However, the file doesn’t seem to get copied into the app bundle when I build (mac app), even though the build logs show it happening:
copySceneKitAssets: Copy plants.dae
copySceneKitAssets: Running scntool on /Users/jason/Library/Developer/Xcode/DerivedData/FirstPersonGame-fxynipfnexmczbgnujwuiqxtiogd/Build/Products/Debug/FirstPersonGame.app/Contents/Resources/catalog.scnassets/plants.dae
When I check that directory in the build folder, catalog.scnassets is there, but it’s empty. Any ideas what might be going on?
Here’s what the file looks like in Xcode’s Identity inspector:
It’s simple!
I was seeing a bunch of warnings like:
scntool: warning: Could not load ModelIO.framework ((null)) (etc)
which led me to this StackOverflow post which solved it for me.
In short: check in Xcode Preferences -> Locations. For me, the “Command Line Tools” had nothing selected (somehow!), so selecting a value there (in my case, Xcode 10.1), then doing a clean build, fixed the issue.
Had the same issue on Xcode 11.3.1 but command line tools are set. Had to uncheck "prefer compressed textures" to make Xcode import the file. This will also make a json file to show up!?

My Xcode simulator's location is stuck on custom Location

I was testing a GPX file with Xcode. I read this tutorial and downloaded this file. Edited my scheme and added the GPX file as a custom location.
Then I decided to change the GPX file. I added the modified GPX file to Xcode. My Xcode crashed. I reopened and added again and it crashed again. I removed all GPX files in my folder and tried adding again, but it crashed again. I cleaned build, cleaned derived data, reset my simulator, restarted my mac. None worked. So I just forgot about adding the GPX file.
Looking into the crash logs of Xcode this is partially what I see meaningful:
ASSERTION FAILURE in
/Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-11754/DVTFoundation/FoundationClassCategories/DVTNSStringAdditions.m:1110
Details: (basePath) should not be nil
I also looked into this Apple Forum thread. But that wasn't helpful.
I also asked a friend of mine to look into that folder and share their file with me. They looked but said they don't have such a file, and yet they don't have any errors :(
So then now I opened another project (I never added any GPX file to this). I'm trying to change the location on the simulator. I set it to Freeway drive. It only enforces a momentarily location update, after that it switches back to Custom Location.
So I did all of the above and also uninstalled Xcode and had in reinstalled. Still same issue, can't change simulator location!
Has anyone had any similar experience?
I'm not sure but I think for things that can be modified from multiple places of your Xcode: You have to go to ALL entrypoints that you can change and just tweak it back and forth see if it works.
I was changing the location from simulator itself. It wasn't working. So I went to:
Edit Scheme >> Options >> Allow Location Simulation
From there I just changed the location between different locations. Quit simulator and all of a sudden I was able to simulate to Freeway drive on my simulator. Haven't tried adding any GPX file yet. Most likely I won't! The issue was too much of a headache!
All you need to do to fix this immediately is to switch Location Services (device or simulator) off and then on.
Settings -> Privacy -> Location Services

xcode delete all data from coder archive

I am using state restoration for my view controllers in Xcode 7.1. But whenever the app initiates on either the simulator or iPhone the old tableview appears. It has rows in it I want to get rid of but my delete code doesn't work. Is there some way to delete coder archived data from a previous build so I get a completely clean tableview to start? I tried in the build target but that didn't help. If I could find where the coder archived data lives in the simulator and get rid of it, maybe that might work?
Here is the state restoration code:
Are you referring to the Derived Data? Xcode allows you to delete the folder, it contains the index, build output and logs. However, I would do a clean then build first, then reset the simulator settings if necessary.
To delete the Derived Data: Window > Projects > select your project and delete
No. I was looking for the DocumentsDirectory in Library/Developer. Here is a link
to a discussion that answered my question. I was able to go in there and delete the *.archive files that were giving me trouble. To be more specific, I incorrectly added some arrays to sections in a tableView, and used State Restoration to save them when I killed the app in Xcode. Then my delete code got exceptions for iterating outside the arrays so I couldn't get rid of them programmatically. But by deleting the archive files using this procedure, I am back in business.
link to access documents directory

Xcode 4 code sense is not working

I am running a "old" Xcode 3 project in Xcode 4 and code sense is not working for my own classes. I have tried following:
Clean/rebuild
Remove Derived Data
Installing 4.3 documentation
Restart
Without any luck.
Sometimes the code sense works but mostly I just get "No Completions".
Try this:
Open Organizer then Project Tab.
Clear the "Derived Data". Xcode should re-index your project then and code sense should work. At least worked for me.
I know this is late, but for reference: http://sealedabstract.com/code/when-xcode-4s-code-completion-autocomplete-breaks/
Close the project, leaving XCode still running.
Open XCode’s Organizer window, go to the Projects Tab, select the correct project, and hit the Delete button next to “Derived Data”.
Quit XCode.
Navigate to your project’s .xcodeproject file in Finder. Right-click, choose “Show Package Contents.”
Leave the project.pbxproj file, but delete the project.xcworkspace file, any .pbxuser files, and the entire userdata folder.
Open the project in XCode. You will see XCode riding high on the CPU usage for around 10-60 seconds, depending on the size of your project. The activity window will say “Indexing”
When your CPU spike returns to earth, code completion will be working again.
There's a lot of deleting going on there so please be careful, but this definitely worked for me.
I've been doing this, and it's worked multiple times for me (after trying all of the above previously).
Edit: Now I just hit space, backspace (the mac version) and rebuild... works nice. Then, remember to scroll (sometimes the colors don't show up until you scroll somewhere)
Find your prefix file: "ProjectName_prefix.pch".
Comment out some line. (basically change it)
Build your project, doesn't matter if it fails or not.
Uncomment it.
Build again.
I'm betting only step 2 (modify the prefix) is what does it, but these essentially get you back to running. Suddenly everything magically recolors itself and completes functions.
Good luck if that doesn't fix it, perhaps try doing this to your dependency pch files (three20 or FB api's)
Clearing the "Derived Data" only works temporarily for me. I have to do it and then restart Xcode like 3-4 times each day to get code sense working again.
I found out the real cause is in the Target's Build Settings. I moved everything from Header Search Paths to User Header Search Paths and it is fixed. In my case, the framework I'm working with is RestKit.
BTW, I came up with this because I was adding another project (QuickDialog) into my project and I was curious that it is using User Header Search Paths, but not Header Search Paths. Here is the difference between them.
You can able to fix that issue by change build settings like this, PreCompile Prefix Headers :NO
FYI, if one file doesn't have code sense but the rest of your project does, check that its added to a target. Once I did that I got code sense back in that file.
It's been ages but the answer is just to move the code into a new folder and the code sense should be working now.
This happened when I added a new Objective-C Class and the code sense doesn't work only on the newly added .m and .h files (on XCode 4 latest update during this post).
Close all xcode windows
Delete all your projects from xcode>window>organizer and restart your project. It will now sense and index your project properly.
I wrote about it in detail here.
Basically my fix was that with localization. I upgraded from xcode 3.2.5 to xcode 4 and then screwed around with built in interface builder and turned on localization for a XIB file accidently which placed my source files in en.lproj directory. After moving them back to Classes folder it worked perfectly.
Again, for the sake of helping others with this issue which, in my case, happened upon upgrading to Xcode 4.3.
Of course I tried the solutions offered in this post, and none of them worked. But the suggestion to move the location of the project in Finder brought back some Code Sense, but the suggestions didn't make any sense.
I ended up deleting my project and re-cloned it from the git repository.That brougt back Code Sense for me...
I open a second project in the background whenever my Xcode's code sensing stops working (it usually works the first time i open the project but after a while code sense no longer works). So what i do is to open a second project in Xcode. Xcode will start indexing the second project and magically the code sense for my main project is back.
Running Xcode 4.3.1 on Lion
Hope this helps someone.
From this comment here I was able to debug the problem on my end, it seemed to be a bad -w flag that the clang preprocessor wasn't recognizing properly. Basically, running
defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3
in Terminal increases the verbosity of the indexer, and should help you track down issues. Open Console.app and look for messages from Xcode, the search string IDEIndexingClangInvocation helped me find them.
For me it happened simply because the file had no target membership. If the first few answers did not work for you, go to your .m file (presumably it's this file that you're having trouble with), open the Utilities view (Edit -> Utilities -> Show File Inspector) and under "Target Membership" check the target to which you want this file to belong.

Xcode shows old, deleted xib files

I've searched all over and haven't found any help...
I built a small test app with two UIViewControllers and their corresponding xibs. Things were fine, then I made some changes to both xibs but when I build and run, I get the old views. I've tried deleting the build folders, running in the simulator and device, cleaning all targets and still the same, old, broke-down xibs that I totally changed are still showing up. I've restarted all the Xcode apps and even my computer.
Getting pretty irritated!
EDIT: I never did figure out what the problem was. Basically, once I had built a project, it remembered the first xibs I made and wouldn't recognize changes to them. If I told a view controller to load from a different, valid nib name, it'd complain that the old one wasn't there.
I reinstalled Xcode and now it all works again. Sheesh.
Try deleting the app from the simulator (hold down on the app's icon to get to jiggle mode, then click the X by the app) and from your device. Then let Xcode reinstall it.
just clean the build using
Product -> Clean
menu.
Just modify your XIB files a bit, then save them, xCode will detect a modification (last modified date in the file system) then load the xib from its actual path, and not from a cache-path :P
I just found (and fixed) a related problem — one that demonstrates similar symptoms but whose root cause is slightly different.
In particular, the symptoms I observed were that my iPad app would initially display an old storyboard image for the first page and, after a short delay, would bring up the most recently edited story board contents. I went through most of the above machinations to no avail.
The problem is that the iPad loader first just dumbly loads your app's launch image into the screen. You usually set up this image as part of the early administrative setup of the app in XCode. At launch time, while the end user is considering the content and cogitating about where to touch the screen, the application is in the mean time madly getting itself ready, un-archiving the xib/nib/storyboard, and doing the real work of getting ready.
In the ideal situation the provided launch image is pixel-for-pixel the same as the one generated by the nib-unarchiving-process. However, if you forgot to update your launch image after updating the story board, you'll see an image shift at the completion of the unarchiving.
I wouldn't have suspected this as the problem except that I had read Jef Raskin's description of how he did exactly this on the Canon Cat word processor to provide the illusion of an instantly ready application: it takes advantage of the fact that the typical human response time to an application startup is on the order of seven seconds — plenty of time for even a floppy-based system to load and overwrite the bitmap facade that the loader sets up. Sometimes, it's good to have read a bit of arcane history. Jef would of course later go on to found a project whose name was Macintosh, and the rest is history — and this bug.
Not sure whether this helps, but I just had this.
It took me days to work it out. In my case I enhanced an existing Xib file. The changes I applied in interface builder never appeared in the app.
Eventually I found the cause. I had my FilesOwner view outlet set to a subview below the top view. When I enhanced the view I did this as an extension to th top view. Thus the changes never appeared when running the app.
Changing the view outlet to the correct view ( the top view in my case ) did the trick and it all worked fine ...
I know steve has found a work around but the problem is not in the XIB files at all. Xcode does not update the YouApplication-info.plist file to
If you open it up you will see the line: Main nib file base name. You must change the value to reflect your desired NIB file name
I had this problem, and it was a result of xcode continuing to copy previously compiled xib's - even though the source file was deleted, the build cache wasn't. Product > Clean and then recompiling solved it.
I just had this issue, just delete the app from the simulator.
Then do a clean on your project.
In xCode,
go to the Product menu,
select Clean.
Or just press Shift+Command+K!
I ended up recreating the xibs from scratch and that worked. Very frustrating.
you can try to modify your XIBs a bit, so xCode will detect a modification through the last modified date in file system. then it will load the xib from its actual path, an not from xCode cache.
I had the same problem, but i solved it by changing the datetime of my system to today. And re-saved the xib. I was testing the local notification.
Just an assumption, not sure if that really caused it: I finished a XIB that worked fine in the simulator and on an actual device. I then changed it to be localised in Xcode 4.5.1. The changes I did after that were not synced to the device until I manually deleted the app from the device and reinstalled via Xcode.
Deleted derived data, cleaned project and build. Old xib was magically removed. :D

Resources