Export Operation
In the first demonstration, we’ll add the ability to export recipes from Core Data so that they can be shared. We’ll create an NSOperation, which will create its own NSManagedObjectContext and use it to copy the selected recipes into a JSON structure, which can then be used by the application in several ways (uploaded to a server, emailed to a friend, and so on).
To implement this addition to our application, we need to make a few changes to the user interface. We want to add a button to the UINavigationBar that’s a generic action item. When the button is tapped, it will display an action sheet and give the user an option to mail the recipe, as shown here (we can add other options later).
To accomplish this, we first add the ...
Get Core Data in Objective-C, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.