Skip to content

Instantly share code, notes, and snippets.

@dodikk
Created November 29, 2013 08:55
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 dodikk/7703124 to your computer and use it in GitHub Desktop.
Save dodikk/7703124 to your computer and use it in GitHub Desktop.
objc_msgSend() and literal constants on x64
const int64_t bytesWritten = 150;
const int64_t totalBytesWritten = 500;
const int64_t totalBytesExpectedToWrite = 3872;
SEL delegateMethod = @selector(URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:);
objc_msgSend
(
mockSessionDelegate, delegateMethod,
mockSession, mockTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite
);
SEL delegateMethod = @selector(URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:);
objc_msgSend
(
mockSessionDelegate, delegateMethod,
mockSession, mockTask, 150, 500, 3872
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment