mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-21 19:42:59 +08:00
Added support for tracking upload progress
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
// TODO: The managedObjectContext should be settable at the class level to ease coupling with
|
||||
// singleton object manager
|
||||
+ (NSManagedObjectContext*)managedObjectContext {
|
||||
return [[[RKObjectManager globalManager] objectStore] managedObjectContext];
|
||||
return [[[RKObjectManager sharedManager] objectStore] managedObjectContext];
|
||||
}
|
||||
|
||||
+ (NSEntityDescription*)entity {
|
||||
|
||||
@@ -177,4 +177,9 @@ typedef enum RKRequestMethod {
|
||||
*/
|
||||
- (void)requestDidCancelLoad:(RKRequest*)request;
|
||||
|
||||
/**
|
||||
* Sent when a request has uploaded data to the remote site
|
||||
*/
|
||||
- (void)request:(RKRequest*)request didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
|
||||
|
||||
@end
|
||||
|
||||
@@ -102,8 +102,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
|
||||
NSLog(@"Connection dedSendBodyData invoked. %d bytesWritten, %d totalBytesWritten, %d totalBytesExpectedToWrite", bytesWritten, totalBytesWritten, totalBytesExpectedToWrite);
|
||||
- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
|
||||
if ([[_request delegate] respondsToSelector:@selector(request:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:)]) {
|
||||
[[_request delegate] request:_request didSendBodyData:bytesWritten totalBytesWritten:totalBytesWritten totalBytesExpectedToWrite:totalBytesExpectedToWrite];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -268,4 +268,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)request:(RKRequest*)request didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
|
||||
if ([_delegate respondsToSelector:@selector(request:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:)]) {
|
||||
[(NSObject<RKRequestDelegate>*)_delegate request:request didSendBodyData:bytesWritten totalBytesWritten:totalBytesWritten totalBytesExpectedToWrite:totalBytesExpectedToWrite];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user