Join Todd Perkins for an in-depth discussion in this video Deleting a document from iCloud, part of iOS App Development: Apple iCloud API (2013).
Let's say at some point you're managing an app that has multiple cloud documents…and you want to delete one of them.…It's actually a fairly simple process. Above where we instantiate cloudDoc in…the getAllNotes method of the data class, I am going to type double brackets and…then NSFileManager defaultManager removeItemAtURL, and the URL for our notes is…self notesURL, and for error I'll just put nil.…
Now to check to see that the file was actually deleted, inside of the completion…handler for cloudDoc's open method, I am going to go inside of the if statement…that checks to see if the file did not exist, and we create the new one.…I'll put an NSLog in there, and I'll type new file created.…This is only going to log to the console if a new file was created.…Let's save this, and what I am going to do is comment out the line of code that…removes the item, and I'll run the app on my phone and make sure to confirm that…it does not say new file created once the app is loaded.…
If it doesn't say new file is created in the log window, then that means that the…
- Understanding the class structure of an app
- Building the data model and constants
- Making your app compatible with the Apple Developer portal
- Connecting to iCloud
- Understanding the UIDocument class
- Handling document metadata class
- Opening, closing, saving, and deleting documents from iCloud
Skill Level Intermediate
iOS 6 App Development New Featureswith Simon Allardice2h 29m Intermediate
1. Building the Note-Taking App
2. Preparing the App to Use iCloud
3. Working with iCloud Key-Value Pairs
4. Working with iCloud Documents
Next steps2m 41s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.