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.
As the first step of creating our data driven application, we will start a new project in Xcode and create the main table view controller. This is the project that will become our BW RSS application. So start by opening Xcode, and we're going to create a new project, so File New, select Project and under iOS and application we're going to select the master detail application. This gives us a table view in the iPhone version, and it gives us a split view in the iPad version, so we'll go ahead and press Next, and we're going to name our project.
We're going to call it BWRSS, organization name, you'll just use whatever you use for that. Company identifier, or I'm using example.com, and this becomes part of the bundle identifier, as you can see down here. It's in reverse domain order and so you want to use your domain name, example.com is a generic one that's set aside for educational purposes like this. And so that's the one that I'm using, and you're welcome to use that or whatever you like in reverse domain format. Under class prefix, again, I'm going to use BWRSS here, and it'll use this to start the names of the classes.
I'm going to select universal, this will create a universal application, an application that has support for both iPhone and iPad. For the first part of the course, we're just going to be developing with the iPhone version and then later on the course, we'll take those same classes, and we'll adapt them for use with the iPad, and you'll see how this is done. I'm going to check Use Storyboards and Use Automatic Reference Counting. We're not using Core Data, we're not using Unit Tests, and I'm going to press Next, and it'll give me an opportunity to create a local git repository.
We're not going to be using this, but it's always a good idea and I'll refer you to the course on git in the lynda.com online training library. And so we'll select Chapter three, and I'm going to click Create, and it has created our project, and if I come over here back to the finder you'll see that there's project called BWRSS, and there's the Xcode project file that's open up in Xcode. At this point, we haven't done anything but create the project and Xcode has assembled a set of templates for us that create actually a working table view application.
So if I go ahead and launch this in the simulator, so I'm going to select the iPhone Simulator and click Run, notice that it compiles it, it builds it without any problems, and it loads up the simulator, and there's our little empty table view application. So I'm going to select Xcode again, I'm going to press Command and the period, and that will stop the application running in the simulator. At this point, there's a couple of things we want to do to do the interface before we start implementing the database. First, we're going to rename the Master View Controller Class.
So you see we have this class here called BWRSSMasterViewController, and I just want to rename this to be FeedsTableViewController. And so, I'm just going to select that and copy it here because we'll be using this. I'm going to come down here to where it says interface, and it has this BWRSSMasterViewController, and I'm going to right-click or Control-click and come down to Refactor and Rename. And there I'm just going to paste in what I typed before BWRSSFeedsTableViewController, and when I click preview it'll show me all the changes that it's going to make here.
You'll notice it updates it in the storyboards, it updates it in the .h and .m files, and it shows me all of these places where it actually changes it, and that's a useful feature of Xcode, it's refracturing for renaming. I'm just going to say Save, and we'll get this little dialog box here that asks if we want to make snapshots. I'm going to say Enable because that never hurts. And there we go. Now we see that these files are now named FeedsTableViewController, I'm just going to update also this one here, this little comment here.
Save that, and I'm going to come over here to the iPhone storyboard, and I'm just going to make a little more real estate on my screen here, and I'm going to come in up here where it says Master, and I'm just going to change that to say BW RSS, and we'll get back to the storyboard later and do some more things. For right now, I'm going to also delete these files over here, BWRSSDetailViewController, and I'm going to move it to the Trash, and I'm going to come in here to our .h or rather our .m file, and I'm going to delete this detail view controller .h reference.
And so, we're just kind of cleaning this up a little bit to get ourselves a nice starting place for our application because I wanted to reflect the type of application we're building not just some generic application. And then just a couple of more clean up things we want to do here, our .h file should be just fine, yeah, actually we need to remove this reference to the detail view controller and remove this reference to the detail view controller. And then in our .m file, there's a couple more things to do here.
Up here this little selector at the top allows me to jump around in the file and come down here to didSelectRowAtIndexPath, and I'm just going to comment all of this out. We'll get back to that later and likewise here this prepareForSegue, comment all of that out. I highlight it and then I press Command then the slash key on my keyboard here in Xcode that comments things out. I'm going to call for this little red line is here, and again, we have a reference that DetailViewController and just all of this code in here we're not going to need this, I'm just going to delete all of that.
There's a few commented out functions down here, moveRowAtIndexPath, canMoveRow, we're not going to be using any of those, I'm just going to delete them and save, and this looks like it needs to be saved over here. Press Command+S. We have a nice, slimmed down, ready to use, and I'm going to save the storyboard as well, and I'm going to go ahead and press the Run button. We have the iPhone selected, and we'll notice that it compiles, and it runs just fine, it says BW RSS at the top here.
So that was simple, we now have a functioning table view controller and then all we need to do is plug in the database calls. The iOS Cocoa touch framework actually makes this all pretty easy, as we'll see as we move forward building this app.
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.