Skip to content

Instantly share code, notes, and snippets.

@conceptdev
Created February 28, 2012 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conceptdev/1935253 to your computer and use it in GitHub Desktop.
Save conceptdev/1935253 to your computer and use it in GitHub Desktop.
NSURLConnectionDownloadDelegate binding
THE OBJECTIVE-C
- (void)connection:(NSURLConnection *)connection didWriteData:(long long)bytesWritten totalBytesWritten:(long long)totalBytesWritten expectedTotalBytes:(long long)expectedTotalBytes
THE MT BINDING
[Export("connection:didWriteData:totalBytesWritten:expectedTotalBytes:")]
public void DidWriteData (NSUrlConnection connection, long bytesWritten, long totalBytesWritten, long expectedTotalBytes) {
----------- LOG (excerpt) ------------
bytesWritten:11261
totalBytesWritten:48365626720256
expectedTotalBytes:11261
bytesWritten:24480
totalBytesWritten:153506426126336
expectedTotalBytes:98106914285587357
bytesWritten:54720
totalBytesWritten:388527036563456
expectedTotalBytes:98106914285642077
bytesWritten:108000
----------------------------
MY HACK
[Export("connection:didWriteData:totalBytesWritten:expectedTotalBytes:")]
public void DidWriteData (NSUrlConnection connection, long bytesWritten, IntPtr totalBytesWritten, IntPtr expectedTotalBytes) {
----------- LOG (excerpt) ------------
bytesWritten:9837
totalBytesWritten:0
expectedTotalBytes:9837
bytesWritten:24480
totalBytesWritten:0
expectedTotalBytes:34317
bytesWritten:53280
totalBytesWritten:0
expectedTotalBytes:87597
----------------------------
https://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSURLConnectionDownloadDelegate_Protocol/NSURLConnectionDownloadDelegate/NSURLConnectionDownloadDelegate.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment