Start learning with our library of video tutorials taught by experts. Get started
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.
At this point, we have a working WebView, and it's being called from the Item View when the user selects an item. Now, let's fill in the details in the class. Let's make a working copy of our webView-01, and you can use your results from the last exercise, or I'm going to use the done version. You can do that too as well. I'll rename this webView-02 and open it in Xcode by double-clicking on the Xcode project file. And we're going to back out here to Finder and grab these methods in this methods.txt file.
I'm just going to copy everything from right up there all the way down to the end of that section and come into Xcode and just place that down here before the end. And we can take a look at these. You'll notice the viewDidLoad has a little red exclamation point. That's because it's a duplicate. There was a stub already in here, so I'm just going to delete that stub and actually get rid of our little red bang there.
So, viewDidLoad is called the after the view is loaded and so it sets the title with the title from the feedItem, and it does some scaling and then it loads the request in the webView, and you notice it's using the webView property which in the .h file is actually an IBoutlet. So, that's already been hooked up in our storyboard. So, that will load the request, and it's going to want to call back the delegate methods, and we'll load those up here in a minute. ViewDidUnload, we just clear out our properties.
When view is loaded again later, that just prevents the same web page from showing up again, which probably won't happen anymore anyway. Some earlier versions of iOS, this was necessary. viewWillAppear, it sets the delegate for the webView to ourselves. And viewWillDisappear, it stops loading if the webView is still loading content, and it clears out the delegate. It also sets the networkActivityIndicator to off. Now, let's come back out here to TextWrangler and load up the WebViewDelegate methods.
So, whatever the document title is set to in the document itself, that will become the title. So initially, we loaded the title up here from our feedItem title, and now after the page is loaded, we update the title to whatever the document title is. And in the event there is an error, we have a little error document here which is just literal strings, which says that we had an error fetching the web page, and it fills it in with the localized description from the error object.
So, that's all really straightforward, and I'm going to save all of this, and we're going to go ahead and run it in the simulator. Make sure the iPhone Simulator is selected and press the Run button. Now, we'll just go ahead and load something from the lynda blog here. And you see, there is our networkActivityIndicator, and here is the document. You see, we have our reload button. If I press that, it reloads the page. There's our network activity spinner, and we have a stop button. So, if I start the reload and press stop right away, it stops it.
We have our action button, which still isn't hooked up. That will just display a log entry. And you notice these back and forward buttons. Those are grayed out. I can't actually press them. They're inactive but if I were to click on a link inside of here--there's our networkActivityIndicator-- we've brought up a new page. So, sometimes the back button doesn't light up, even though it's supposed to, and if you press the reload button, it makes it work. And this is just a bug in the webView. So now I can press this back button, and you see there's our networkActivityIndicator, and it's going back to the previous page.
And now, the forward button is lit up because that is now active, and it's now possible for that to work. So, if I press that, we'll go forward. I press that, we go back. So now, we have a working webview. Again, using the Cocoa Touch classes has made this very easy. Most RSS feed items point to a web page, so this solution makes it easier for us to display that rich data without a lot of coding. While our webView does display the content nicely and has a few useful features for navigation, it's not a full web browser.
So, we have a button for passing control of the content to Safari. When I press this button, of course right now all we got is this log entry. So, our remaining task is to implement that button.
Find answers to the most frequently asked questions about iOS SDK and SQLite: Building Data-Driven Apps.
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.