Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Correct SimpleBackgroundTransfer sample to export optional protocol s…
Browse files Browse the repository at this point in the history
…electors (#410)

- Fixes #406
- Optional protocol methods must export if you use IFoo instead of Foo base class
  • Loading branch information
chamons authored Nov 3, 2020
1 parent 0a6947d commit 56aa9e2
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public UrlSessionDelegate (SimpleBackgroundTransferViewController controller)
this.controller = controller;
}

[Export ("URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:")]
public void DidWriteData (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long bytesWritten, long totalBytesWritten, long totalBytesExpectedToWrite)
{
Console.WriteLine ("Set Progress");
Expand Down Expand Up @@ -121,6 +122,7 @@ public void DidFinishDownloading (NSUrlSession session, NSUrlSessionDownloadTask
}
}

[Export ("URLSession:task:didCompleteWithError:")]
public void DidCompleteWithError (NSUrlSession session, NSUrlSessionTask task, NSError error)
{
Console.WriteLine ("DidComplete");
Expand All @@ -137,11 +139,13 @@ public void DidCompleteWithError (NSUrlSession session, NSUrlSessionTask task, N
controller.downloadTask = null;
}

[Export ("URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:")]
public void DidResume (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, long resumeFileOffset, long expectedTotalBytes)
{
Console.WriteLine ("DidResume");
}

[Export ("URLSessionDidFinishEventsForBackgroundURLSession:")]
public void DidFinishEventsForBackgroundSession (NSUrlSession session)
{
using (AppDelegate appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate) {
Expand Down

0 comments on commit 56aa9e2

Please sign in to comment.