Re: deleting files on install [iphone]
Re: deleting files on install [iphone]
- Subject: Re: deleting files on install [iphone]
- From: Steve Christensen <email@hidden>
- Date: Wed, 29 Sep 2010 07:41:14 -0700
On Sep 29, 2010, at 7:03 AM, Roland King wrote:
> I'm working on an iPhone app which has as part of the bundle a small directory of static HTML files. I keep them in my code directory and have a custom copy phase to copy them into the bundle on build. That copy is very simple, just copies to 'Resources' and the whole hierarchy gets copied (thanks to those blue directories I don't fully understand but they work).
Yellow folders are just logical groups of items that may or may not reflect an actual hierarchy on disk. Blue folders do represent an actual directory on disk; when you build, Xcode will automatically copy that directory and its contents into your app as part of the standard "Copy Bundle Resources" build phase.
> This is good. I find that if I remove or rename files in my source directory (rename FOO to BAR) then that's properly reflected in the build product, the old files are removed, the new files are there, it's as if the directory was rsynch'ed into the build product.
>
> However when the application is installed into the simulator it appears that the current contents of the build directory is copied over what is there already, so if I had a FOO directory and renamed it to BAR, I get both of them, any other files removed or renamed are still there from before.
I don't believe that Xcode actually iterates over a blue folder's hierarchy and synchs the corresponding contents in the app with the contents in the original directory. More likely it just makes sure that the items in the original directory end up in the app, whether or not there are any stragglers from previous builds. (In other words, it copies but does not synch.)
> I've tried messing about with custom build phases, including those for 'install only' but cannot find a way to clean my custom directory before the files are copied over.
You could either find the app in the build directory, delete it and rebuild the app, or do a clean build. Either way you'll be starting with a blank slate.
> I don't know if this is going to affect the device as well (it's a bit harder to figure out what files are installed there) or if it's just the way the simulator is synched and I need to just clean the directory manually (~/Library/Application Support/iPhone Simulator .. etc) when I make changes.
>
> Is there a custom step I can use here to clean the simulator install directory before the install happens and is this something I will need to worry about on the device itself or am I guaranteed when an install to the device happens it goes in totally clean and wipes all that was there before?
Doing a build for the simulator or a build for the device will give you the same results; Xcode is unlikely to do it the "right" way in one case and the "wrong" way in another.
I assume that the set of HTML files will only be changing as you do development, and that when you're ready to ship, the set of files/file names won't change further. If so, I wouldn't worry about it during development (simulator or device) unless having HTML files with the old names in addition to the new/correct names could affect the operation of the app.
When you're ready to do a distribution build, you can do a clean build in one of the ways I mentioned above to make sure you're only copying the latest and greatest files to your shipping product.
steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden