Join Todd Perkins for an in-depth discussion in this video Adding notes when cloud data is found, part of iOS App Development: Apple iCloud API (2013).
Now we've already looked at overwriting all of your local data with cloud data.…But let's say you don't want to do that, you just want to detect whenever…new cloud data is added and then you want to add new notes that weren't there before.…So let's look at how to do that.…In dataUpdatedFromCloud, in Data.m, I'm going to delete the line of code that sets allNotes.…Here I'm going to create a loop that's a for in loop, so I'm going to loop…through all of the keys, so those are NSStrings we're calling key in cloudData.…
And what I want to do is check to see if the key in cloudData is not already…a locally saved note.…And if not I'll add it to the local notes.…So all I need to do is check to see if the value for that key is nil in all notes.…So in allNotes objectForKey, key is equal to nil, and we are going to add it.…So in brackets allNotes setObject, and the object is going to be cloudData…objectForKey, key, and the key is going to be key as well.…
So now what should happen is that when we actually update a note on another…
- 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?
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.