nsdocumentdirectory

Save Data to .plist File in Swift

对着背影说爱祢 提交于 2019-11-26 08:16:51
问题 I am trying to save data to a plist file in swift, but the data isn\'t showing up as it was saved when the plist is read. This is the code I was using. var documentsDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as NSString var path : NSString = documentsDirectory.stringByAppendingPathComponent(\"data.plist\") var data : NSMutableDictionary = NSMutableDictionary(contentsOfFile: path) data.setObject(self.object, forKey: \"key\") data.writeToFile

What is the documents directory (NSDocumentDirectory)?

被刻印的时光 ゝ 提交于 2019-11-26 01:49:16
问题 Can someone explain to me what the documents directory is on an iOS app and when to use it? Here is what I believe at present: To me, it seems to be a central folder where the user can store any files needed for the app. This would be a different location than where Core Data stores its data? It seems like each app gets its own documents directory. I am free to create a subdirectory of the documents directory, like documents directory/images, or documents directory/videos? 回答1: Your app only

What is the documents directory (NSDocumentDirectory)?

雨燕双飞 提交于 2019-11-26 00:44:59
Can someone explain to me what the documents directory is on an iOS app and when to use it? Here is what I believe at present: To me, it seems to be a central folder where the user can store any files needed for the app. This would be a different location than where Core Data stores its data? It seems like each app gets its own documents directory. I am free to create a subdirectory of the documents directory, like documents directory/images, or documents directory/videos? WrightsCS Your app only (on a non-jailbroken device) runs in a "sandboxed" environment. This means that it can only access