Hi, I have been playing around with the new Pubsub framework. I have been trying to get it to list everything in a feed. I have used the documentation for this, but it still wont work. If anyone has any experience with this pubsub framework please help! I have posted my code that I am trying to use below.
PSClient *client = [PSClient applicationClient];
NSURL *url = [NSURL URLWithString:
@"http://www.apple.com/main/rss/hotnews/hotnews.rss"];
PSFeed *feed = [client addFeedWithURL:url];
// Retrieve the entries as an unsorted enumerator
NSEnumerator *entries = [feed entryEnumeratorSortedBy: nil];
PSEntry *entry;
// Go through each entry and print out the title, authors, and content
while (entry = [entries nextObject]) {
NSLog(@"Entry Title:%@", entry.title);
// I get an error Here saying that "Title" is not right
NSLog(@"Entry Authors:%@", entry.authorsForDisplay);
// I get an error here
NSLog(@"Entry Content:%@", entry.content.plainTextString);
// AND I get an error here
}
// Then i try to download the attachment
// Get the enclosures from the current entry, and retrieve the first one
NSArray *enclosureArray = entry.enclosures;
enclosure = [enclosureArray objectAtIndex: 0];
NSError *error;
// Download the enclosure
if (![enclosure download:&error]) {
NSLog(@"Enclosure download failed: %@", error)
} else {
// Register for any changes to the download's state
[[NSNotificationCenter defaultCenter]
addObserver:self
selectorselector(downloadStateChanged
name: PSEnclosureDownloadStateDidChangeNotification
object: enclosure];
}
PSClient *client = [PSClient applicationClient];
NSURL *url = [NSURL URLWithString:
@"http://www.apple.com/main/rss/hotnews/hotnews.rss"];
PSFeed *feed = [client addFeedWithURL:url];
// Retrieve the entries as an unsorted enumerator
NSEnumerator *entries = [feed entryEnumeratorSortedBy: nil];
PSEntry *entry;
// Go through each entry and print out the title, authors, and content
while (entry = [entries nextObject]) {
NSLog(@"Entry Title:%@", entry.title);
// I get an error Here saying that "Title" is not right
NSLog(@"Entry Authors:%@", entry.authorsForDisplay);
// I get an error here
NSLog(@"Entry Content:%@", entry.content.plainTextString);
// AND I get an error here
}
// Then i try to download the attachment
// Get the enclosures from the current entry, and retrieve the first one
NSArray *enclosureArray = entry.enclosures;
enclosure = [enclosureArray objectAtIndex: 0];
NSError *error;
// Download the enclosure
if (![enclosure download:&error]) {
NSLog(@"Enclosure download failed: %@", error)
} else {
// Register for any changes to the download's state
[[NSNotificationCenter defaultCenter]
addObserver:self
selectorselector(downloadStateChanged
name: PSEnclosureDownloadStateDidChangeNotification
object: enclosure];
}