- (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error |
|||||
Description |
Removes the file or directory at the specified path. |
||||
|
Prior to removing each item, the file manager asks its delegate if it should actually do so. It does this by calling the fileManager:shouldRemoveItemAtURL: method; if that method is not implemented (or the process is running in OS X 10.5 or earlier) it calls the fileManager:shouldRemoveItemAtPath: method instead. If the delegate method returns YES, or if the delegate does not implement the appropriate methods, the file manager proceeds to remove the file or directory. If there is an error removing an item, the file manager may also call the delegate’s fileManager:shouldProceedAfterError:removingItemAtURL: or fileManager:shouldProceedAfterError:removingItemAtPath: method to determine how to proceed. Removing and item also removes all old versions of that item, invalidating any URLs returned by the URLForPublishingUbiquitousItemAtURL:expirationDate:error: method to old versions. |
||||
Parameters |
|
||||
Returns |
YES if the item was removed successfully or if path was nil. Returns NO if an error occurred. If the delegate aborts the operation for a file, this method returns YES. However, if the delegate aborts the operation for a directory, this method returns NO. |
||||
Availability |
iOS (2.0 and later) |
||||
Declared In |
|||||
Reference |
5 1 | I have been using a plist to store data in my app. I have been able to write and read from the plist with no problem. I created this plist in XCode, adding the rows of numbers, dictionaries, and arrays myself. However, I would like to be able to reset the plist to the original state, and there must be an easier way to do this than writing a 0 or nil value to every entry in the plist. So what is the easiest way to reset the plist to its initial default state? | ||
add a comment |
10 | The simplest thing would be to delete the file using NSFileManager, like this:
Or if you don't want to do that, assuming the plist is a dictionary, just load the one from your application bundle and then overwrite the one in your documents, like this:
Which will overwrite the saved file with the original file. | ||||||||||||||||
|
1 |
| |||
0 | You could also try to just rename your Plist. Thats the least work i think. |
'모바일개발(Mobile Dev) > IOS개발(ObjectC)' 카테고리의 다른 글
background thread in iOS (0) | 2015.12.12 |
---|---|
How to clear UIWebView cache (0) | 2015.12.12 |
A better way to access NSUserDefaults (0) | 2015.12.11 |
Sending Image from Xcode to Server (0) | 2015.12.11 |
Xcode 6 Strange Bug: Unknown class in Interface Builder file (0) | 2015.12.11 |