Вы находитесь на странице: 1из 11

How to setup an RSS feed so it shows up in the iPhone application

! The iPhone application supports both RSS 1.0 and RSS 2.0. RSS 1.0 and RSS 2.0 are both open standards that describe in detail how the data returned to the iPhone application should be formatted. RSS 2.0 is the strongly recommended format to use in your RSS feeds since it allows the inclusion of multimedia such as videos, images and podcasts in your content. This allows a much richer and engaging experience for your users and helps to boost the popularity and use of your iPhone application. By providing an RSS 2.0 feed this will allow the creation of iPhone App Buttons that behave similar to the following:

When a row in the table is touched by the user either more information can be displayed or a video or audio le played for the user. What is displayed to the user and what happens when a touch occurs depends entirely on what is in the RSS feed. The following is an example RSS 2.0 document which would display images:

The RSS 2.0 Specication is available at the following website: http://www.rssboard.org/rss-specication What the iPhone application looks for several of the above listed tags when it is interpreting the RSS feed. The relevant tags and how they are interpreted are listed below:

<item> tag
Each row in the table displayed to the user corresponds to a <item> in the RSS feed. Each item as described in the RSS feed are separated by horizontal lines on the iPhone screen. An example is shown below as well as an iPhone screen highlighting different items.

<title> tag Each RSS item has a title tag. The title is what is displayed to the user in larger font at the top of each item being displayed in the iPhone table. This title can be any length you desire as it will not get cut off by the iPhone application. Instead the application will resize the row as large as necessary to accommodate the title. An example is below: <title>Medicine interested in new physics research</title> Highlighted below are some example <title> tags showing up in the iPhone application: (not all <title> tags are highlighted).

<description> tag
Each RSS item has a description tag. The description is what is displayed to the user in a smaller grey font at the bottom of each item. This description is can be any length you desire including empty but should still be present. If you have a long description currently not all of the description is displayed and it will get cut off if it is too long. An example is below: <description>The latest tips from New Yorks premier gardening website.</description> Highlighted below are some example <description> tags showing up in the iPhone application: (not all <description> tags are highlighted)

<enclosure> tag
The enclosure tag is optional but should generally be included in all RSS feeds you create for the iPhone application to make using your application a richer experience for your users. The enclosure tag allows you to embed images, audio or even video into your application in one straight-forward process. Below is an example of how to embed images in the RSS feed so they show up in the iPhone application. <enclosure url="http://blogs.usask.ca/ussu/ussu.jpg" length="5388" type="image/ jpeg" /> The URL section of the enclosure tag lists the full URL to the image to be displayed. For image sizes you generally want to use portrait and not landscape images since landscape images may shown up small or be cutoff at the edges. Also, for image sizes images are generally resized down to approximately 81x108 pixels in size for display on the iPhone application. It is generally recommended that you do not use images larger then 250x250 pixels for the iPhone application since it just increases download size without increasing the experience for the user. Note any image le larger then one megabyte in size will not be displayed to the user. The length section of the enclosure tag currently isnt read by the iPhone application but it should be included if you want your RSS feed to conform to the RSS specication. The type portion of the application describes the type of image being displayed. The types of images which can be used with the iPhone application are PNG, JPEG, TIFF and GIF. PNG being the recommended type since it is the recommended image format for the devices, though all supported image formats will work. Possible types for the type eld are shown below for the different image types: PNG image: image/png JPEG image: image/jpeg TIFF image: image/tiff GIF image: image/gif Only if you use the tags as shown above will the image show up in the iPhone application. The entire enclosure tag should be <embedded> inside a <item> so the general format should be: (omitting some text) <item> ... <enclosure ... /> ... </item>

Note embedding images in the iPhone application can only be done through the method described above. Highlighted below are some example images showing up in the iPhone sourced using <enclosure> tags as described above. Notice that a combination of portrait and landscape images are being shown.

Audio
The <enclosure> tag can also handle audio and those are inserted in the RSS feed in a similar method to images. An example is shown below: <enclosure url="http://deimos.apple.com/WebObjects/Core.woa/FeedEnclosure/ usask.ca.2167067194.02167067196.2175745967/enclosure.mp3" length="6814107" type="audio/mpeg" ></enclosure> The URL in the enclosure tag above links to an MP3 le which is the supported format for audio in the iPhone application. In this case it is podcast audio le hosted on Apples servers but it could just as easily been a MP3 le hosted on any server only the URL would differ. The type is audio/mpeg as is required for audio in the iPhone application. Just like with images the length tag is ignored by the iPhone application but should still be included. Each item highlighted below when clicked would play the appropriate audio le based on the contents of the <enclosure> tag.

Below is what the iPhone application looks like while an audio le is playing.

Video
The <enclosure> tag can also handle video and those are inserted in the RSS feed in a similar method to images and audio and can offer a much richer experience for users as well. An example is shown below: <enclosure url="http://www.usask.ca/research/communications/multimedia/ shedding_light/m4v/intervac.m4v" length="24534856" type="video/x-m4v" /> The URL in the enclosure tag above links to a iPhone formatted video le. Only video formatted for the iPhone can be played in this way. Two video types are supported by the application M4V and MP4: M4V: video/x-m4v MP4: video/mp4 Just like with images and audio the length tag is ignored by the iPhone application but should still be included for standards compliance. Each item highlighted below when clicked would play the appropriate video le based on the contents in the <enclosure> tag.

<link> tag
Each RSS item has a link tag. The link tag tells the iPhone application in the cases where an audio le or a video le isnt dened with an enclosure tag, where the iPhone application should navigate once an item is touched. Once an item is touched which doesnt have an audio or video le the iPhone application will load information from the specied URL. An example of using the <link> tag is below: <link>http://huskies.usask.ca/news/2010/February/2010-02-13-mvb/index.php</link> Once this item is touched data should load from the URL above if no audio or video le is dened using the enclosure tag.

RSS Standards Compliance


All the information provided above is what the iPhone application currently uses to load information into the application. When you are creating your RSS feed you should also check to make sure your feed is compliant with the RSS standards to ensure no problems are encountered with your feed. Though not all tags dened in the RSS standard are used by the iPhone application currently it is still recommended that you validate your RSS feed to avoid any problems. W3C offers a free RSS validation service online at the following URL: http://validator.w3.org/feed/ It is recommended that you validate your RSS feed using this page to ensure no problems are encountered in getting your information loaded into the iPhone application.

Вам также может понравиться