Add new RKReachabilityState, RKReachabilityIndeterminate.

Make RKRequestQueue smart, don't start dequeuing requests until reachability state has been determined.
Simplify examples.
This commit is contained in:
Jeremy Ellison
2011-01-06 14:12:14 -05:00
parent 46974bb4c7
commit b31e6426a5
5 changed files with 20 additions and 41 deletions

View File

@@ -37,26 +37,7 @@
_tableView.backgroundColor = [UIColor clearColor];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
// Load the object model via RestKit
if ([[RKClient sharedClient] isNetworkAvailable]) {
[self loadData];
} else {
NSLog(@"Network is not available");
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:RKReachabilityStateChangedNotification object:nil];
}
}
- (void)reachabilityChanged:(NSNotification*)note {
if ([[RKClient sharedClient] isNetworkAvailable]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:RKReachabilityStateChangedNotification object:nil];
[self loadData];
} else {
NSLog(@"Network is not available");
}
}
- (void)loadData {
// Load the object model via RestKit
RKObjectManager* objectManager = [RKObjectManager sharedManager];
[objectManager loadObjectsAtResourcePath:@"/status/user_timeline/twotoasters.json" objectClass:[RKTStatus class] delegate:self];
}