Deal of the Day

Home » Main » Manning Forums » 2008 » iPhone in Action

Thread: Chapter 20: RSS Reader URL Don't Load in UIWebView

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 1 - Pages: 1 - Last Post: Jun 26, 2009 3:13 PM by: shannon.appelcl...
DenVog

Posts: 1
From: Silicon Valley, CA, USA
Registered: 6/26/09
Chapter 20: RSS Reader URL Don't Load in UIWebView
Posted: Jun 26, 2009 11:27 AM
  Click to reply to this thread Reply

I am working with the RSS Reader example from Chapter 20, using articles loaded from the Apple Hot News feed
http://images.apple.com/main/rss/hotnews/hotnews.rss

Some URL open in the UIWebView, but others don't (tested in simulator and on device) and I don't see the difference. All open fine in Safari on my desktop. They also will open in a browser or the iTunes Music Store on a device, if I hard code them into an app and use something like:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=309327900&mt=8&sr=hotnews"]];
WORKS
Title: Download iTunes U programming directly to your iPhone
http://www.apple.com/education/mobile-learning/?sr=hotnews?sr=hotnews.rss
DOES NOT WORK
Title: Apple sells more than a million iPhone 3GS models
http://www.apple.com/pr/library/2009/06/22iphone.html?sr=hotnews%20?sr=hotnews.rss
Title: iPhone 3G S the “best all-around smartphone available”
http://gizmodo.com/5293388/iphone-3gs-review?sr=hotnews

WORKS
Title: Keeping Earth out of harm’s way
http://deimos3.apple.com/WebObjects/Core.woa/Browse/kqed.org.1366667554.01366667559.1997639845?i=1317485246&sr=hotnews
(opens iTunes Store on device, shows "Contacting iTunes U..." on simulator.)
DOES NOT WORK
Title: App Store Pick of the Week: At Bat 2009
http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=309327900&mt=8&sr=hotnews
(On the device this should open the App Store. I know from experience that the device seems to want URL formatted as "itms://phobos.apple.com" or "http://phobos.apple.com" in order to launch the iTunes music store, but these seem to be working as-is when hard-coded.)

I'd really appreciate it if someone can tell me why some URL don't work, and what I need to do to fix this. Thanks.

shannon.appelcl...

Posts: 55
Registered: 5/29/08
Re: Chapter 20: RSS Reader URL Don't Load in UIWebView
Posted: Jun 26, 2009 3:13 PM   in response to: DenVog in response to: DenVog
  Click to reply to this thread Reply

Re: Apple sells more than a million ...

If you look, you'll see the URL being given for this entry is formatted incorrectly, with two ?s:
http://www.apple.com/pr/library/2009/06/22iphone.html?sr=hotnews%20?sr=hotnews.rss

Re: The best all-around smartphone:
If you're patient, this one will load, just very slowly

I don't know about the funky Apple store URL, but I suspect it's also got some minor glitch that prevents a bare UIWebView from loading it.

For a live app, you'd probably want to spend some time testing the URLs (unless you *know* you can trust them) and you'd also likely want to show a loading icons to let people know stuff is going on and to fail gracefully if a URL fails to load altogether. (For one example of the latter, see pp.403-405).

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor