Join Todd Perkins for an in-depth discussion in this video Saving data to a file, part of Building a Note-Taking App for iOS 7.
…Now, our data class is actually complete for…the purpose of this application that we're making.…However, one thing a lot of people want to do…in creating applications is save data to a file.…Now we're not going to be applying that in our application, but I wanted to…show you how to do it since it's something you'll likely use at some point.…So we're going to modify our code to save to a file.…Now if this is not useful to you then you can come back to it later if you want.…Go to data.m.…We're going to create a new method right on your save notes and it's going to turn…an NS string and I'll call it file path, and in here,…I am going to create a variable, and that data type is going to be an NS array.…
We'll call this directories, and we'll…set it equal to NSSearchPathForDirectoriesInDomains.…This is going to give us an array of directories.…And what we want is our documents directory,…so the first parameter I'm going to pass an NSDocumentsDirectory.…The first parameter I'm going to pass in, NSDocumentDirectory.…
These courses take you through building a complete mobile app from scratch; this installment uses the iOS SDK and Xcode to get the job done. Author Todd Perkins shows you how to create an Xcode project, lay out apps visually, connect UI elements to code, and save data to persistent storage. Start here, and compare and contrast your results with the other courses to learn about the differences and similarities of the platforms.
- Previewing the note-taking app's features
- Creating the Xcode project
- Using local data storage
- Creating a data class
- Saving data to a file
- Understanding screens and storyboards
- Creating and editing notes
- Controlling note display in a table view
- Deleting notes