/
BFBriefcastViewController.m
84 lines (62 loc) · 1.97 KB
/
BFBriefcastViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// BFBriefcastViewController.m
// Briefs
//
// Created by Rob Rhyne on 9/14/09.
// Copyright Digital Arch Design, 2009. See LICENSE file for details.
//
#import "BFBriefcastViewController.h"
#import "FeedParser.h"
@implementation BFBriefcastViewController
@synthesize table, refresh, channelTitle, channelLink, locationOfBriefcast;
///////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark UI Methods
- (IBAction)refreshBriefListing
{
}
///////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark UIViewController overrides
- (void)viewDidLoad
{
[super viewDidLoad];
if (locationOfBriefcast != nil) {
// Load Briefcast url
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[self locationOfBriefcast]]];
[[[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES] autorelease];
}
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload
{
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc
{
[super dealloc];
}
///////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark NSURLConnectionDelegate Methods
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSError *error = [[NSError alloc] init];
FPFeed *feed = [FPParser parsedFeedWithData:data error:&error];
[self channelTitle].text = [feed title];
[self channelLink].text = [[feed link] href];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
// TODO: do something here.
// Boom, we failed.
NSLog(@"Boom, the briefcast load failed.");
}
///////////////////////////////////////////////////////////////////////////////
@end