cocoa touch - What's your method for this... wiping out your DocumentsDirectory during iPhone development? -


I'm sure there is a better way to do this. I have a part of this code that I use to eliminate the document directory on an iPhone or simulator. Sometimes I just want a clean slate, and sometimes I change a database and I have to rebuild it. Then, one of my actions gets called that when I turned on my app, I commented this code out, and I want to reset the comment block when I remove it. What do you do

NSFileManager * fileManager = [NSFileManager defaultManager]; NSArray * path = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, Yes); NSArray * dirContents = [File Manager Directory Resource: Atapath: [Path Object Art Index: 0]]; (Int i = 0; I & lt; [dirContents count]; ++ i) {NSString * theDir = [[paths objectAtIndex: 0] stringByAppendingString: [@ "/" StringByAppendingString: [dirContents objectAtIndex: I]]] ; NSLog (theDir); If ([filemanager removeItemAtPath: theDir error: zero]) {NSLog (@ "removed dir"); }}

I am a novice iphone developer if it were something like a python server, I would just run a script I, but I'm sure the XCode / iPhone conference for this I'm not.

After

I usually just remove the need for app simulator every time I need to clear this directory.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -