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.
Oftentimes an application needs a simple way of allowing users to choose some default values for settings. You can do this with a modal dialog if you have enough of a settings requirement to justify the coding in UI investment. The simple solution, however, is to use the iOS settings interface. Here, we have our BW RSS application so far, running on the iOS Simulator. And because again, the small screen that I'm working on the iOS simulator has no border, and it has no Home button.
So, if I want to press the Home button, I press Shift+Command+H on my keyboard. So if I want to change the settings, I need to press the Home button and run the Settings application and scroll down here till we see our BW RSS application, and there's the Settings. So, I can set the maximum items per feed, and I can see the version number. This is a very simple usage of the settings. So, if you have just a few things to set, or if you want to display a version number or something like that, Settings is a common way to do this.
So, I'm going to quit the simulator for now, and we're going to come in here to our BWRSS-preferences-start, and I'm going to make a working copy, and I'm just going to rename this to BWRSS preferences. We're not going to have a separate version for a later movie. And I'm going to launch it in Xcode by double-clicking on the Xcode project file. So, I'm going to go ahead and open up this disclosure triangle, and I'm going to set the iPhone Simulator.
Under Supporting Files here, we don't yet have it, but we're going to create a settings bundle. So, I'm going to right click on Supporting Files, and I'm going to say New File and under iOS, Resource, I'm going to select Settings Bundle and press Next. Now, you want to leave this default name because that's important. It won't work if it's named something else, and you wanted in the Supporting Files Group and in your BWRSS targets.
So I'll press Create, and now we have our settings bundle. So, I'm going to go ahead and open that disclosure triangle there, and I'm going to select the Root.plist, and that's where we actually are able to set the preferences. You'll notice that there's a disclosure triangle here next to this thing called Preference Items, and there is four items in there and those are just examples, and we're not actually going to use those. You see, this interface is really weird. When you click on stuff, stuff happens, and you sometimes have to press Escape.
So, I clicked on that and then I pressed Escape. I'm going to press my Delete Key here on the keyboard and just delete those three items and then I'm going to come back up here to Item 0 (Group - Group), and I'm going to open it up and under Title, I'm going to call this, Feed Settings. So, I'll select this over here, and I'll type Feed Settings, and we're going to leave that one as group as Type for this Item 0. That fills out Item 0. Item 0 has a type of group, and it has a title of Feed Settings.
And then with this closed, I'm going to press the Enter key, and it will create a new item. I'm going to press Escape, and I'm going to press Enter again, I'm going to do that several times until I get four items here. So, I have three new items under Item 0 Group, and we're going to fill these in. The first one, Item 1, its type is going to be Multi Value. So, under Type, you'll notice that the arrow is way over here. I can select that and say Multi Value and its title, I'll double-click in that space there for the title is Max Items Per Feed, like that.
It also gets an Identifier, and that's going to be max_items_per_feed, and you notice it's an identifier. It's going to be referenced from the code, so I don't want spaces in, and I'm using underscores. It's going to get a few more things, so I'm clicking over here on the left because that seems to be a fairly safe place to click, and I'm going to press the Enter Key, and I get a new item. This item is going to be a default value so that's correct, and its type is going to be a number.
And over here, I'm going to double-click on that number it'll allow me to edit it, and that's going to be 50. So, it's going to have a default value of 50. And when I press Enter, this editor is just really weird for these types of items, so you have to bear with it a little bit. So, that's default value. And then we're going to have a new item called Titles, and I'm just going to close that real quick and make another one and a new item called, Values. So, it actually defaults to the correct thing here, and if it doesn't, you can always press that little arrow to the right of the field that you want to change, and you get an opportunity to change it.
So under Titles, there's going to be four items. Again, cursor jumps around, two, three, and four. Under values, there's going to be four items. So, I open that up, and I have one, two, three, and four. All of these values are going to be type Number. So we'll just go ahead and change those right now. And their values are going to be 25, 50, 100, and 250.
And then the titles for each of these items are going to be Strings and they're just going to say the same thing, 25. I guess I could spell it out if I wanted to. So, these will be the labels that will be next to each of these values, 250. We'll see how these looks like in the Settings app in a little bit here. So, there is our titles and our values, and that's Item 1 Multi Value. Item 2 is really just a spacer. It creates an empty space.
So, its Type is a Group and its Title is blank, and there is no key, so I'm just going to delete that one. Item 3, its Type is Title, and its Title is Version, its Identifier is BWRSS_Version like that with an underscore, and it's going to have a Default Value, and we'll just give it a version value here, 3.1.0, and there, we're done.
So, I'm going to press Command+S to save this. Now again, to press the Home button, I'm pressing Shift+Command+H, and I'm going to come out here to the Settings. I'm going to scroll down here, and there is our BWRSS, and there we have our Max Items Per Feed, which we can change, and we have our Version, which when we click on this, nothing happens. And you see our title there, it says Feed Settings. So, that's all of these things here. So now that we have a working settings bundle, we need to be able to read these values in our code.
And we'll take a look at how to do that in the next lesson.
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.