Fix incorrect comments about retaining object loaders. Fixed deprecated references to globalManager/globalClient

This commit is contained in:
Blake Watters
2010-12-27 21:56:38 -05:00
parent 979d79d414
commit a61728aa28
3 changed files with 11 additions and 11 deletions

View File

@@ -26,14 +26,20 @@
// Add our element to object mappings
[mapper registerClass:[RKTUser class] forElementNamed:@"user"];
[mapper registerClass:[RKTStatus class] forElementNamed:@"status"];
// Update date format so that we can parse twitter dates properly
// Wed Sep 29 15:31:08 +0000 2010
NSMutableArray* dateFormats = [[[mapper dateFormats] mutableCopy] autorelease];
[dateFormats addObject:@"E MMM d HH:mm:ss Z y"];
[mapper setDateFormats:dateFormats];
// Create Window and View Controllers
RKTwitterViewController* viewController = [[[RKTwitterViewController alloc] initWithNibName:nil bundle:nil] autorelease];
UINavigationController* controller = [[UINavigationController alloc] initWithRootViewController:viewController];
UIWindow* window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[window addSubview:controller.view];
[window makeKeyAndVisible];
return YES;
}

View File

@@ -34,9 +34,8 @@
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
// Load the object model via RestKit
// Retain the object loader that is returned so that it is not dealloc'd after the request is sent.
RKObjectManager* objectManager = [RKObjectManager globalManager];
[[objectManager loadObjectsAtResourcePath:@"/status/user_timeline/twotoasters.json" objectClass:[RKTStatus class] delegate:self] retain];
RKObjectManager* objectManager = [RKObjectManager sharedManager];
[objectManager loadObjectsAtResourcePath:@"/status/user_timeline/twotoasters.json" objectClass:[RKTStatus class] delegate:self];
}
@@ -53,14 +52,12 @@
[_statuses release];
_statuses = [objects retain];
[_tableView reloadData];
[objectLoader release];
}
- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error {
UIAlertView* alert = [[[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
[alert show];
NSLog(@"Hit error: %@", error);
[objectLoader release];
}
#pragma mark UITableViewDelegate methods

View File

@@ -57,8 +57,7 @@
- (void)reloadButtonWasPressed:(id)sender {
// Load the object model via RestKit
// Retain the object loader that is returned so that it is not dealloc'd after the request is sent.
RKObjectManager* objectManager = [RKObjectManager globalManager];
RKObjectManager* objectManager = [RKObjectManager sharedManager];
[[objectManager loadObjectsAtResourcePath:@"/status/user_timeline/twotoasters.json" objectClass:[RKTStatus class] delegate:self] retain];
}
@@ -70,14 +69,12 @@
NSLog(@"Loaded statuses: %@", objects);
[self loadObjectsFromDataStore];
[_tableView reloadData];
[objectLoader release];
}
- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error {
UIAlertView* alert = [[[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
[alert show];
NSLog(@"Hit error: %@", error);
[objectLoader release];
}
#pragma mark UITableViewDelegate methods