From 9e93bad83c9e980cb593dc057fe8af40f35652f1 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Thu, 19 Nov 2015 17:02:35 -0800 Subject: [PATCH] CB-8863 fix block usage of self --- src/ios/CDVFileTransfer.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ios/CDVFileTransfer.m b/src/ios/CDVFileTransfer.m index dca440a..ee32b92 100644 --- a/src/ios/CDVFileTransfer.m +++ b/src/ios/CDVFileTransfer.m @@ -305,13 +305,14 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream) fs = [[self.commandDelegate getCommandInstance:@"File"] filesystemForURL:sourceURL]; } if (fs) { + __weak CDVFileTransfer* weakSelf = self; [fs readFileAtURL:sourceURL start:0 end:-1 callback:^(NSData *fileData, NSString *mimeType, CDVFileError err) { if (err) { // We couldn't find the asset. Send the appropriate error. - CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[self createFileTransferError:NOT_FOUND_ERR AndSource:source AndTarget:server]]; - [self.commandDelegate sendPluginResult:result callbackId:command.callbackId]; + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[weakSelf createFileTransferError:NOT_FOUND_ERR AndSource:source AndTarget:server]]; + [weakSelf.commandDelegate sendPluginResult:result callbackId:command.callbackId]; } else { - [self uploadData:fileData command:command]; + [weakSelf uploadData:fileData command:command]; } }]; return;