Viewers: in countries Watching now:
The iOS software development kit (SDK) includes the popular SQLite library, a lightweight yet powerful relational database engine that is easily embedded into an application. In this course, Bill Weinman teaches you how to build an RSS reader for iOS devices, integrating XML data and a streamlined interface. He explains how to use the SQLite database, display information in a table view, code view controllers, and create a preferences pane for your app. The resulting application is optimized for all iPhone and iPad displays.
Now that we're parsing the feed header, we need to send data back to the FeedsTableViewController for processing. Remember, the AddViewController object is a modal dialog. What we want to do is little processing as possible there. We created a small delegate protocol for communicating with the FeedsTableViewController, and now we're going to use it. So, let's start by making a working copy of addView-04, and I'm going to use my -done version. You can use the one that you worked on in the last movie if you like, if you've been following along. And I'm just going to call this addView-05, and I'm going to open it in Xcode by double-clicking on the Xcode project file.
Now, if we notice in our addView.h file, we have this protocol that we define, this RSSAddViewControllerDelegate protocol. And it has three methods in it, and those methods are actually going to be run in the FeedsTableViewController. So, the FeedsTableViewController is going to be the delegate for this delegate protocol. And you'll notice right here we have this property which is called delegate, which is of type id with this delegate protocol. And you'll notice, back here in our haveFeed method, we actually call haveAddViewRecord, which is one of our delegate methods, haveAddViewRecord on that delegate.
So, I'm going to uncomment this, and I'm going to uncomment this to dismiss the view controller. And now we need to set this delegate property here, and that gets set from the FeedsTableViewController. Now, in the FeedsTableViewController, this is going to be a set in our segue, because our segue is what happens when we press on that Plus button. Then we get the segue to the AddViewModelController and the model controller, it slides up the screen with that animation. It covers the entire screen. And before we can start handling this in the segue, we need to know about it, so we're going to come in here to our controller.h, and I'm going to import our AddViewController header. And I'm going to come down here to our interface which defines the class type and the parent class type.
I'm going to declare this protocol type as well. So, this is our RSSAddViewControllerDelegate. So, I'll save here, and I'm going to come back over here to the end file, and now we can handle this other segue. Now, if you remember, we come over here to the iPhone storyboard--and I'm just going to display this right side real quick. So, this is the segue here, and it has the segue identifier, SegueToAddView, so I'm just going to copy that so that I can paste it in and know that I have spelled it correctly.
Over here, I'm going to say else if (segue. identifier isEqualToString:@"SegueToAddView"), and then I'm going to declare a pointer to the BWRSS AddViewController class. And that's our destinationViewController in the segue, so I can just say destinationViewController. Now that we have a pointer to that destinationViewController, I can set its delegate to this FeedsTableViewController.
Now, when the AddViewController calls something on its delegate, it's going to be calling it on this controller, the BWRSS FeedsTableViewController. This controller is declared to handle that protocol. You notice up here it says that our protocol is not implemented yet. That's because we haven't yet added those methods. And so I'm going to add those methods right here before the database methods. And we'll come out here to the Finder, and we'll open our 05-methods.txt file, and there they are. I'm going to select all and copy and come back into Xcode and paste them in right there. Command+S to save.
So now, our AddViewController, when it has a feed, it's going to call this haveAddViewRecord with the feedRecord. Here in our FeedsTableViewController, here it is, and it's going to get that record, it's going to sign it to this new feed variable. And so we need to do one more thing. When that gets assigned, we need to come back up here in our view stuff, and I'm going to come down here and I'm going to declare a viewDidAppear, and if (newFeed), (self loadNewFeed).
If we come down here and we see what loadNewFeed does, it goes ahead and either inserts it in the database or updates it in the database, and it does this nice animation reveal. We'll see what that looks like right now. We're going to go ahead and run this in the simulator. So now, let's go ahead and add that CNN feed-- CNN.com--and I'll press Add, and you see it has that nice little horizontal reveal. You notice it's using this UITableViewRowAnimationLeft, and it's using the same one here when it's updated.
So, if I go ahead and put in that same URL, you'll notice that it comes in here and it just rotates it into place like that. So, if we come back up here to our AddViewControllerDelegate method, you'll notice here that there is URL errors and there is RSS errors. So, if I come back here to the simulator-- and let's just put in something that doesn't have a feed, like for instance music.bw.org I know that one doesn't have a feed--and it says, RSS Error did not find a feed.
So, that's this haveAddViewRecord message. And for an error, if I put in a URL that just doesn't exist, like x.y, and click Add, it says, URL Error, a server with a specified host name could not be found. So, those are these two messages here. So now the feed is being properly added and updated, and it's all working quite well. The delegate protocol that we created is very easy to use, and it's also working well. This allows the modal view to do its job while passing its results back to the main view so that it can do its job. It's all very neat and tidy.
Find answers to the most frequently asked questions about iOS SDK and SQLite: Building Data-Driven Apps (2013) .
Here are the FAQs that matched your search "" :
A: The RSSDB library had to be updated to work around a bug in the iOS 7 SDK.
There is a bug in the iOS 7 SDK that prevents the BWDB fast enumeration implementation from working on a device. The symptom is code that runs fine on the emulator, but not on a device. iOS devices use an ARM processor, while the emulator runs on your Mac's Intel processor. This points to the LLVM ARM code generator as the source of the bug. Because the bug appears to be in the LLVM compiler, it may be some time before it is fixed.
As a workaround we have changed the getFeedIDs and getItemIDs methods in the RSSDB library so they don't use Objective C fast enumeration.
Please note that this same bug also affects some of the BWDB testbed code in Chapter 2. The result is that it will run on the emulator but not on a device.
"Used type va_list (aka_builtin_va_list) where arithmetic or pointer type is required"
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.