Video hosted by Apple at devstreaming-cdn.apple.com

Configure player

Close

WWDC Index does not host video files

If you have access to video files, you can configure a URL pattern to be used in a video player.

URL pattern

preview

Use any of these variables in your URL pattern, the pattern is stored in your browsers' local storage.

$id
ID of session: wwdc2011-504
$eventId
ID of event: wwdc2011
$eventContentId
ID of session without event part: 504
$eventShortId
Shortened ID of event: wwdc11
$year
Year of session: 2011
$extension
Extension of original filename: m4v
$filenameAlmostEvery
Filename from "(Almost) Every..." gist: [2011] [Session 504] Building Ne...

WWDC11 • Session 504

Building Newsstand Apps

Internet & Web • iOS • 42:18

Newsstand lets you simply and easily deliver magazine and newspaper content to iPhone, iPod touch, and iPad users. Master the APIs needed to create Newsstand apps, and see how to configure Newsstand apps in iTunes Connect. Learn how to customize the home screen icon of your Newsstand app, and discover the best practices for downloading and storing new issues, managing old issues, and more.

Speakers: Jon Drummond, Ben Nielsen

Unlisted on Apple Developer site

Downloads from Apple

HD Video (278.3 MB)

Transcript

This transcript was generated using Whisper, it has known transcription errors. We are working on an improved version.

So first thing we're going to cover is what does it take to get your app into Newsstand? This will include info PLS keys you're going to need to adopt, as well as all of the new icon variants available to you, and where they're used. And then we're going to talk about how do we go through the process of getting content from your servers down into your app on a user's device? And then once it's there, how do you let the user know that new content is ready for them to view? And with that, I'd like to invite my colleague Jon up here to tell us what we need to know about appearing in newsstand. Here you go, John.

Thanks, Ben. Hi, everybody. I'm going to tell you today how to make your app appear in Newsstand. And there are two pieces to this. The first is how to make your app a Newsstand app, and the second is how to define your Newsstand icon. Well, first things first, how do you become a Newsstand app? Well, it's rather straightforward. You have to add one key to your Info.plist.

That key, UINewsstandApp. It's a Boolean, set it to true, and congratulations. You're now a Newsstand app. But we're not quite done yet. Because you need an icon. Now, you are probably all familiar with this, but there is one icon style in iOS today. And it looks a lot like this.

iOS 4, that is. Now, you see it on the home screen, but you also see it in search, you see it in settings, you see it in the app switcher, and you even see it in the new notification center. Well, as Ben just showed us, publications in an actual Newsstand don't quite have the same look. They're colorful, they're exciting, they grab your users, your readers in this case, and pull them in.

I mean, look at this guy, he's standing up on the edge of a cliff. I want to pick that magazine up and look inside and see what it's all about. And we want to bring that same experience to Newsstand. So let's talk about Newsstand icons. For one, they've got a distinct look from standard app icons. They appear in Newsstand, that is, on the home screen, and in the app switcher.

We want these icons to reflect your content. When a user takes a look at your app without even opening, we want them to be able to see what's inside. Furthermore, they're dynamic. You can update them after your app is installed. On top of that, we give them some additional adornment to make them look like real magazines and real newspapers.

So, standard icons. Well, we still need them. As I mentioned, we use them throughout iOS in a series of other places, not just in the home screen, but in settings, search, notifications. So that means we need to define a Newsstand icon in addition to the standard icon. Now, how do we do standard icons today? You've probably all done this once or twice.

You add your list of icons to your Info.plist in an array called CFBundleIconFiles. You give us a list of images, that's your standard icon. Well, this doesn't work for Newsstand icons, because if you added more things to that list, we wouldn't have any idea what's the Newsstand icon and what's the standard icon. So we need a new way to specify your Newsstand icon.

What we've added is a new InfoPillars key called CFBundleIcons. Now, this is not specific to Newsstand. Any app in iOS 5 can use it. And what it is is a dictionary of icon styles. So in iOS 5, we defined two styles. The first is your standard icon, which we've called CFBundlePrimaryIcon. The second, as you may have guessed, is your Newsstand icon, which is called UINewsStandIcon. So let me show you how you would go and take this, and make your app have a Newsstand icon.

First step, add your new P-List key. CFBundleIcons, it's a dictionary. We'll start with the standard icon. So we'll insert another dictionary, CFBundlePrimaryIcon. Within that dictionary, you can literally copy-paste your existing array of images. And now you have a fully defined standard icon style. So what does it take to then add the Newsstand icon style? Well, what you would do is you'd insert a new style key called UINewsStandIcon. And within that style key, you'd again insert an array of images, and that would specify your Newsstand icon. But you're not done yet, because you can customize your Newsstand icon.

As I mentioned before, icons are adorned to resemble their physical counterparts. So when you're doing this, you have to decide, are you a newspaper, or are you a magazine? Furthermore, you have to define a binding edge. That is, what is the edge of your publication that opens when the user opens it up? A typical magazine here would open from the left, or the staples would be on the left, so that's the binding edge. These are defined as option keys inside the Newsstand icon style dictionary.

So let me go over these two binding types. The first is binding type magazine. If you had a publication that looked something like this, you would be a magazine. What we do is we apply staples to one edge, and then pages on the other edge to give it a little bit of depth. The other style is a newspaper. If you look something like a newspaper, you would be one. And we give you a stack effect and a fold along the bottom edge. Now, I mentioned binding edges. There are three possible options for this. The first.

Is UI Newsstand binding edge left. In this example in the magazine, this is an image with a left binding edge. That's where the staples go. In some other countries, binding edges may be on the right. So if you have a publication that is like that, this example image would have the staples then on the right side and the pages on the left. The last binding type is meant for newspapers, and that is binding edge bottom. That's what lets us apply the fold along the bottom of the newspaper.

How do you then take this and apply it to your icon style? Well, we'll start with our icon style dictionary that we just defined, and then we'll add in our binding type. In this example, I'm using a binding type newspaper. And then I'll add the binding edge key under there, in this example, binding edge bottom. Together, this creates an icon that looks something like this.

Now, there are a few additional considerations to keep in mind when defining your Newsstand icon. The first and foremost is that your icons do not need to be square. Standard icons today expect a square image, but we want you to use a shape that actually matches your physical appearance. So if you're a magazine, you might be taller than you are wide, or a newspaper, you might be wider than you are tall. Whatever it is you look at, use those dimensions for your image.

Furthermore, you must still define your primary icon. We need both of them in iOS, your Newsstand icon for Newsstand and App Switcher, and your standard icon for everywhere else. The last point is that while CIF bundle icons is required for Newsstand apps in iOS 5, the new key will live perfectly well with the existing icon key. So if you're targeting an earlier iOS version, you don't need to worry about that. They will coexist peacefully.

And with that, I would like to give you a demo. And what I will be doing is taking a standard app, as we all have today, and converting it into a Newsstand app with an icon. All right. Unfortunately, I can't make this font size any bigger, so I'm going to zoom in a bit, but let me know if you can't see. The first thing I'm going to do is, well, let's run this app and see what it looks like today.

As I mentioned, this is just a standard app. I'm going to exit back to the home screen. And there it is, NKDemo. This is my app. Let's make it a Newsstand app. The first thing we have to do is add our UI Newsstand app key. As I mentioned, that is a Boolean. Yes.

Save, and let's run. Exit back to the home screen, and now you can see there's something in the Newsstand. And we open it up, and here's my app. Now, that doesn't really look all that great. It's got my old icon crammed into a sort of newspaper-y looking shape. So let's quit and define our Newsstand icon. All right, I've got this pasted to the clipboard, so I can do it quickly.

We'll name this CFBundle Icons. Now, I've included two styles within here. The first is the primary icon, and the second is my Newsstand icon. You can see my primary icon is empty, so I need to add my existing list of images to it. I'll just go up here. This is my standard image.

Copy you, come in here, paste, that's it. I've also included another image in my project and newspaper that will be my Newsstand icon. will save. Oh, you can also tell I've added the binding type newspaper and binding edge bottom, because I'm a newspaper. When I run. Exit back to the home screen. I'm still there in the Newsstand, but now I look like an actual Newsstand app. And that's it. That's all it takes to make your app a Newsstand app.

And now, I'd like to hand this back to Ben, who will be telling you all about content updates. So that's kind of exciting, isn't it? I mean, I really like this new look for Newsstand apps. I think it's really fun. But moving away from the home screen visuals, let's talk about getting content, and specifically how Newsstand Kit can help.

So this process, this is going to be a cycle that you're going to go through repeatedly, right? I mean, every 24 hours, week, month, whatever it is for your app, you're going to be doing this all the time. So we're going to spend a bit of time on this. It has four steps.

The first step-- is how do you let your app know that new content is available? And then once you know that it's available, what do you have to do on disk to kind of prepare a place to put all the files that you're about to download? And then you have to actually download them. And then once you've got all of that, you're going to have to update your icon and your badge to let the user know that it's now ready to be viewed. So let's talk about informing the app.

Well, when we look at all of the technologies available to us, really, push notifications match our needs the best. But they've got one flaw in terms of what we want to do here, and that's that they're meant to inform the user. If your app isn't running, we let the user know, and not your app. So really what we needed is a type of push notification that always goes to your app, even if it's in the background, or even if it's not yet running.

And so that's what we've done, is we've added a new type of push notification-- we call it Newsstand push notifications-- to do this. Now, we're not going to go too deep into what is push notifications. So if you've got a lot of questions, if you're new at it or you need a refresher, there's always the remote and local notification programming guide on the Apple Docs.

And then, of course, there are other sessions, and you're always welcome to come and ask us about it in the labs. We'd be happy to answer any questions you have. So in order to take advantage of Newsstand push notifications, what's different? What do you have to be aware of? Well, the first thing is we have a new registration type. And that is Newsstand content availability. You'll need to add this registration type to your registering for remote-- for push notifications when your app launches.

Once you do that, you can receive them, but you're also going to need to mark your notifications as being Newsstand notifications. You do that with a new payload key, which is content available set to a value of 1, and you set that inside of your APS reserved dictionary for the payload.

You do that, congratulations. You're now sending Newsstand notifications. And that's almost everything you need to know. But there are two caveats. The first one is you can only receive this type of notification once in a 24-hour period. So if we look forward to the future here a little bit, iOS 5 ships in fall. That's, say, roughly three months away. That's 90 days, 90 opportunities to test this feature. So I hope it goes really smoothly and you get everything working in the first 90 days.

OK, well, maybe that's not really feasible. So we've added an override. You can set it in your NSUser defaults. That's just a Boolean value for the key, NK don't throttle Newsstand content notifications-- or Newsstand-- yeah, that's right. You set that key, and we will let you receive it as many times as you want to your heart's content on your developer devices. So that's the first thing you need to be aware of.

The second thing you need to be aware of is that because we'll actually be waking you up in the background, it means we're playing with the multitasking system. So you're going to have to let the multitasking system know that you're going to need to support being woken up for those reasons, which means a new background mode. So the background mode you're going to need is Newsstand content. You set that key inside of your UI background mode's array in your Info.plist. Doing that lets us know that we should wake you up.

The other thing you need to know is this background mode only buys you a couple of seconds to process that notification. Hopefully, that's all you're going to need. But if it isn't, you can always tell the system that you're going to begin a background task, and you'll get the 10 minutes that this function will buy you. Don't forget to check it in, though.

OK, so that's it. We now know-- we've now been able to inform the app that there's new content available. The app's going to have to prepare a location to put all of that content. So how do we go about doing that? Well, you're going to need to persist some state information, and actually create a place on disk to put it all.

And since this is everything that all of you are going to be doing, we've created a new class called NK Library as a part of Newsstand Kit to do this for you. So NK Library provides a persistent state, specifically for information regarding all of the available issues on the user's device, as well as all of the downloads that are either scheduled or currently in flight, as well as other metadata, like what issue is a user currently interested in.

Beyond just state information, it also helps to actually organize your disk. It does that all inside of the application's caches directory. We play nice with backup. You may be asking yourself, "Why did you go to the trouble of making this class for me? I could do this." That's true, but since all of you are going to do it, we wanted to make it simple.

But then also, there's one other reason, and that's by sharing just a limited amount of information of the structure of your app, we're actually able to improve the cache management system in terms of both efficiency and user friendliness. So it's really a win-win for everybody. So that's NK Library. But NK Library is meant to manage issues.

So how do you go about adding an issue? To create an issue, all you need is two bits of information. The first is, you're going to need a name that will uniquely identify that issue. We don't care what it is, set it to whatever you want, but it needs to uniquely identify it.

And you're going to need to tell us the publication date of that issue. Once you know those two things, you just call up on the library, add issue with name and date, and we will go ahead and return you an NK issue. Now this actually creates and maintains a repository within the library. And in this repository, you should put all of the content. associated with your issue.

And you can get that by just querying the issue for its content URL, and use that as the base for all of your file system manipulations. And the other thing that you can do with issues is that you can tell us what the most important issue currently is. And not just us, I mean, this is also you. You're going to need to persist this information somehow. And you do that just using the currently reading issue property of the library.

That's easy. It's really simple to organize it all. At least we hope you think it's all really simple. So now that we've created a place to put it all, we're going to need to download all that content. And this is really the meat of what you're going to be doing every so often. So let's talk about it.

Well, without Newsstand Kit, your app is going to have to be running, set up an NSURL connection, and then it's going to have to stay running in order to get all of that content, right? To get all of the did-receive-data callbacks on your delegate. Well, this doesn't work so well, right? Because we could take and put you all into the background, and then in the worst case, we've got tens, if not hundreds, of news apps that are trying to download large amounts of content all the time. In that case, trust me, nobody wins.

It's just really bad. So what we needed to do was provide you a facility to hook directly into the system's downloading mechanism, so that everything can be well organized, and we can maintain good performance. So we've done that by adding NKAsset Download. NKAsset Download will actually handle all of the data transfer and storage of that to disk for you.

And because it's a part of the system, that means it can keep processing, even when your app is suspended or even quits. But we didn't want to create an entirely new download mechanism you'd have to learn. So we're piggybacking off... of the familiar NSURL connection delegate that you already know, so all of the complex things you may need to do with that download, like authentication, are all handled in the same mechanism. Which means we're going to wake you up to process those events specifically. Again, that means we're playing with a multitasking system. You have to declare a background mode.

But it's the same one as before. So you set it for push notifications, and you got it for downloads. So that's easy. Now, one caveat to know is that while your app is frontmost, you've got access to any network connection the user has. But if you're backgrounded, all of your downloads will only happen over Wi-Fi. So good to know.

So what does it take to actually set up one of these downloads? Well, once you know that issue's available, you've gone through, you've created a space on disk using NK Library and NK Issue, you're going to need to also know what it is you need to download. And for that, that's really up to you.

You're going to need to query the server. You need to do subscription validation or whatever. Maybe you're talking to lots of different servers. Whatever it is for you, you're going to get a list of all of those things you need to download. And you're just going to iterate over that list and create an NSURL request. And you're going to create a request for each item.

And once you have that request, you're just going to call add asset with request for the particular issue you're downloading for, passing in the request you just made. And that'll return you an NK asset download. To begin the download, all you have to do is call download with delegate, passing in your connection delegate. And that's it. We're now downloading, potentially in the background.

So let's take a look at this delegate. It's not actually an NSURL connection delegate. It's actually an NSURL connection download delegate, which is a new protocol in iOS 5 specifically to support NewsstandKit. But it implements NSURL connection delegate, which means this is how you receive all of your status updates. It's how you receive your authentication challenges and your notifications of when the download is finished. But it does modify things just a little bit.

And the big thing is, well, you used to receive connection-did-receive data, but since we're handling all of the data, this method doesn't make a whole lot of sense. So we've gone ahead and replaced that with two status update mechanisms that you can use to know how the system is progressing with your data. And, of course, connection-did-finish-loading doesn't tell you where on disk we stored all that information.

So we've replaced that one with connection-did-finish-downloading, passing you back a destination URL. Now, the first two, seeing as they're status updates, are optional. Don't have to use them. But the last one, of course, is required, because there's no other way for you to know how to process this event.

So you get all of these delegate callbacks if you're frontmost. So how does that change if your app has been suspended? You're just not going to receive any more status updates. That's it. But you are still going to be woken up in the case of an authentication challenge or a completion event.

So not too different. But what's the difference if your app has actually been terminated? Well, for the same reasons that we would have reactivated you if you were suspended, we're just going to relaunch you in the same event. So you're in the background. You won't be frontmost. You'll be in the background.

But you will be able to process this notification, which means we're going to have to tell you why you were launched. So in the launch options dictionary, we're going to pass you some new values for this key, which is Newsstand downloads. And the value is going to be an array of unique identifiers for those assets that caused you to launch. You can query to figure out what that is on the asset by just asking for its identifier property.

OK, so now you're asking yourself, or you may be asking yourself, I understand that the download may be continuing on in the background. That's fine. It's a system thing. But if my app has been terminated, the application delegate that I created doesn't exist anymore. So how am I supposed to get status updates for that download? Which brings us to a really good point. You're going to need to reconnect to those downloads. The process, again, it's very simple. We've tried to make it as... We'll try to make it as easy as possible.

Hopefully we did a good job. You're just going to have to query the library for all of the downloading assets, and then call download with delegate again, passing in your new delegate. That'll then go and find it, reconnect to it, and you'll immediately start receiving all of the updates that you have been needing to process.

This brings us, though, to a really important point, and that is you're going to need to always, always connect all of your downloading assets every time you launch. Don't just go and find the ones that actually caused you to launch, because you may have lots of others in process that don't actually need your interaction right now.

And if you don't hook up to those, you no longer have any reason, any way of knowing what's going on with them, and you've essentially abandoned them. The system can detect that, and may cancel those downloads, since you can't know what's going on anyway. So please remember to always connect all of your downloading assets on relaunch.

So hopefully we've gone through and we've processed these, and now we've come back and it says your download is finished. In the case of an error, it's the same mechanism, so we won't talk about that, but hopefully it's actually completed successfully. In that case, you're going to receive connection to finish downloading with your destination URL. This destination URL is actually a temporary file. It's only guaranteed to exist for the duration of this callback. So the first thing you want to do is move that file into your issue repository.

Remember, you can do that very simply by getting the content URL of the issue, and using that to build your relative path where you're going to move this file. Now, you're going to possibly want to process this file, and what do I mean by that? Well, hopefully you're not scheduling 500 downloads. You can, but it's really not a great experience. So what you're going to want to do, hopefully, is kind of package them up, maybe into a zip archive, or an SQLite database, or some other type of flat file, we can just send a few of them.

But if you're going to do that, it might take you a while to process. And remember, we only give you a couple of seconds to handle all of these notifications. Again, you may want to let the system know you're beginning a background task as you unarchive or decrypt or whatever it is you may need to do.

So, and that's really it. Once you know that, process your file, congratulations, you now put all of that content into your issue. And I'd like to show you a demo of walking through all of these steps for a sample issue. All right, so the very first thing we do, we're using the same app that Jon was working with before. You can see all the keys that he's added in here.

So the first thing we're going to want to do is add the background mode. There we go. So we're just going to call in required background modes, which is an alias for... for UI background modes. And then we're going to type in this new string, this new background mode, which is Newsstand content.

We do that, now we can start receiving all of these things in the background. Let's save that, and now let's move over to the application delegate. Now the application delegate, for simplicity's sake, is where we're going to do all of the processing for this app, just so everything's nice and clear in one file.

there we go. It gives us a little bit more room. Now, the very first thing we're going to do normally, well, actually, let's show you the app so you can see what it looks like. You can see it's just a table view that shows us the state of all of our current downloads.

Now, I'd really like to show you the push notification system, but since we're running in the simulator, I actually can't do that. But trust me, it works. It's really, really cool to not see what's happening. But instead, what we're going to do is we're going to kick things off with this download button.

So first thing that I would normally do is I'm going to, for development purposes, I'm going to set the default that gets rid of the limitation of only one push notification per day. And then I would come in, and I would register for the new push notification type using the new enum, UI remote notification type, Newsstand content availability. But we're not actually going to do that because we can't do push notifications. But I just wanted you to see that.

So what we are going to do is we're going to look in our launch, we're going to look for any assets that may be downloading that we haven't, you know, that we haven't been connected to. And we're going to find them, and we're going to call download with delegate again. You can see that I'm using my application delegate as my download delegate as well, again, for simplicity's sake. So I've done that. I've reconnected. I can, you know, I'm good to go.

Now, once I receive the start download event, I'm going to come, and I'm going to have to begin that, oops, begin that download. So I'm going to need... To ask the server, this is all a little simplified here, I know, but I'm going to just query the server and say, get me the latest issue info so I can check against it, right? And that's going to return me an object that I can use to see what it is I may need to download.

And the next thing I'm going to do is, I need to check the library and see, do I already have that issue? Because I already have it, there's nothing I need to do, right? But we're going to assume then that I don't have that issue, and I just need to create it.

So I'm going to call add issue with name, passing in the name field that I just queried from the server, as well as the publication date of that issue. Now I've got the NK issue, this has created the location on disk for me where I need to put everything, and I'm just going to need to create an asset download. Now in this case, I know that I've put all of my content into one database file, so I'm just creating one asset download, and that is my content request.

You can see I've created my NSURL request here. And I pass it in and I get my NK asset download. Right after I do that, I am going to set something we didn't actually talk about. Now, when you start, when you go and query the server, you're probably going to know exactly where you need to put all of those files. And if they are packaged up in some special way, you're going to have all the information of how to unpackage it. But keep in mind, when you process it, your app may have been terminated, even many times.

And so, unless you have a specific application, you're going to have to do a lot of work to get it done. And unless you have a way of persisting that information, when it comes to process, you may not know how. So we provided a simple, a simple accessor here. You can set a user info dictionary of plistable types to store any information you need at the time you have to process this download. Though you may want to keep in mind that it's always good to keep this dictionary as small as possible.

So once we've done that, and here what I'm doing is I'm just getting the content file name and creating a dictionary that just has a file name mapping to that string. So once I do that, all I need to do is call download with delegate, passing myself in. And there we are. The download is now underway in the system.

So what else do we need to process this now? Well, we have an NSURL connection download delegate, so let's flush out some of those methods. Now, I'm not terribly interested in the status and the errors that may be returned. My UI needs to know about it, so what I'm doing here is I'm just forwarding all of those methods off to my UI manager, so that it can tell us what's going on. But there's not too much for us to do with that in this demo.

So, but hopefully, it will have downloaded successfully, and we'll get this connection to finish downloading with the destination URL. Once I get that, I'm going to need to actually get the Newsstand asset that I was using. But you notice that it repassed me back an NSURL connection object. We've added a protocol to the NSURL connection class, or sorry, a category to the NSURL connection class to retrieve the asset that created it if there was one. So I've queried back and gotten the NK asset. download that created that connection.

The next thing I'm going to do is pull out the user info and find the file name that I need to process this, to figure out the relative path this will go inside of my issue. And then I'm actually going to construct that file URL by using the issue's content URL and impending my relative path.

So I'm almost done. All I have to do now is actually move that content file into my issue using the standard NS file manager routines. And the last thing, well, I need to let my UI know that it's finished so that we can see that all nice and run. So let's actually run that and see what happens.

So here's my app, and I'm going to hit Downloads to simulate the push notification coming in. See it drop down. Oh, well that's fun. Let me quit this again and run it, and hopefully... Oh, hey, it's off and running. Little UI glitch there. Sorry about that. So let's go ahead and pause. In fact, you've already seen that, where we paused it and we came back, and it was still running. Yay.

Let's actually terminate the app, kill things off completely. And just for good measure, let's even remove it from the multitasking tray down here at the bottom. OK, so we left off. It was like 40%, I think it was. We go back, we should see it significantly higher than that.

And now we're at 65%. And really, it was that simple. Just a few lines of calls, and we're actually downloading content in the background, and it continues, even when our app is not. So I hope you enjoy that. Thanks. Thanks. So, I'm going to invite Jon back up here to tell us how do we then update the visuals on the home screen to let the user know that we've now downloaded all this fantastic content.

Thanks, Ben. How cool is that? I think your users are going to love getting this data in the background while they sleep, or whatever. So, I'm going to tell you about updating your Newsstand icon. So, now that you've got all this new content, you want to show it off. Well, part of getting new content is also obtaining a new icon for your content. How you do this is entirely up to you, but it's got to be part of that process.

So, once your content's ready to view, we want you to be able to show it off. Now, to do that, we have two ways. The first, let's update your Newsstand icon. The second, let's inform the reader that you have a new issue available via badging. So, if your icon had looked like that before, when the user wakes up, now they've got a new cover and a new tag, or a new badge.

Updating your icon. Well, publication covers play a huge role in the physical Newsstand, and we've reiterated that multiple times today. We want your icons to do the same thing here. Your icon should reflect your most recent content. We want the users to see at a glance what they're going to get when they tap your app in the home screen.

But don't show it until the content is ready to go. Nothing would be more disappointing than to see a new icon representing supposedly new content, but to open your app and find nothing. So once you've got your content available, then it's time to show off your icon. Now, this will change the appearance of your app in Newsstand and the app switcher. It overrides the UI Newsstand icon style that we talked about, but not your standard app icon.

Now, how do we do this? Well, it's rather easy, and we've added a single line API on UI application called Set Newsstand Icon Image. However you get this image, that's up to you. Make this call. We'll take care of the rest and update your Newsstand icon. Furthermore, you can do this in the background. So if we launch you for a content, did finish downloading, and you're done processing, that's fantastic. Go ahead and update your icon. We'll do it for you. You can suspend, and the user won't have to do anything.

On top of that, you can now badge your app. And I say now badge your app. It's because we've given them a new look. What you see now is a new sash that appears over the upper right-hand corner of your Newsstand icon. We want you to add a badge when you've got new content that the user has not opened, and then remove the badge when the user's read your content. Now, this API is exactly the same as the existing badge API. You call UI application, set application icon badge number.

As with normal badging, a non-zero value will show the sash, and a zero value will clear the sash. Now, we no longer show the count. You won't see one, two, three, four, five. It just says new. But you can still use the count to keep track of your unread issues.

Now, I'll show you a very simple example that will pull this all together. Let's say you're inside your connection to finish downloading delegate method. Well, we've got one asset, and it just finished. So we're going to pull the issue out for that asset by getting the downloading assets issue, and then getting the issues content URL, and building a path to where we're going to put it.

We move it into place. You just saw Ben do this. Very simple. The next step, get your icon image. Again, how you do this is entirely up to you. I added a helper method here that pulls it out of my issue wherever you store it. That's yours. Once you've got that, you can just call a new API. Set Newsstand icon image. And here, I'm updating the badge by incrementing it by one. That's it. You've just updated your Newsstand icon. And to show you how easy this is, I will do a demo.

All right, here we've got Ben's program that he was just working on. What I'm going to do is modify it slightly. I'm going to change the download of his content to just download an icon. We don't need the whole thing. Icon request, icon file name. I'll scroll down here to the bottom into my connection did finish downloading, and I'm going to add just a few lines of code.

The first, let's get my image. I know my download is an icon, a PNG, so I'm going to say UI image, image with contents of file, and the path where I just moved my download. I'm going to update the Newsstand icon and badge by calling the new API setNewsstandIconImage with my new cover art, and then incrementing the badge by one. Save, run. Let's clear that existing download. We don't care anymore. I'll start a new one.

It looked like it finished already. And there's our new icon with the new badge. And that's it. So what have we learned today? The first thing was how to become a Newsstand app. All you have to do, update your info P list, add a Newsstand icon, good to go. The second part was getting content updates in the background. There's a new push notification type for you, and a new background mode that allows you to be launched without user interaction to begin your content downloads.

The third part was all about Newsstand Kit, and how you can use it to organize your content, and how it can help you download assets in the background. Now, there are two points I want to reiterate here briefly, is that you always have to reconnect your downloading assets when you launch. You just have to do this so that we can send you the messages about their status.

The second is let Newsstand Kit know about the currently reading issue. This will help us effectively manage the user's caches. Lastly, once you've got this awesome new content, update your Newsstand icon and your badge to tell the user the next time they open their device, they'll see Newsstand, and they'll see your new content, ready to go.

For more information, you can contact Vicki Murley. We have documentation, although I don't have a link to it here. If you go to the dev portal and search for Newsstand, you'll see the Newsstand kit documentation come up. We have some related sessions. We're also doing this particular session again on Thursday, if for some reason you want to come back and see us again. App publishing with iTunes is next Thursday. Local and push notifications, also on Thursday. And multitasking, helpfully at the same time as the push notification session.