diff --git a/src/ios/CDVFileTransfer.m b/src/ios/CDVFileTransfer.m index 66cb9a1..5dca9a4 100644 --- a/src/ios/CDVFileTransfer.m +++ b/src/ios/CDVFileTransfer.m @@ -289,7 +289,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream) delegate.source = source; delegate.target = server; delegate.trustAllHosts = trustAllHosts; - delegate.filePlugin = [self.commandDelegate getCommandInstance:@"File"]; + delegate.filePlugin = (CDVFile *)[self.commandDelegate getCommandInstance:@"File"]; delegate.chunkedMode = chunkedMode; return delegate; @@ -328,7 +328,8 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream) if (sourceURL) { // Try to get a CDVFileSystem which will handle this file. // This requires talking to the current CDVFile plugin. - fs = [[self.commandDelegate getCommandInstance:@"File"] filesystemForURL:sourceURL]; + CDVFile *filePlugin = (CDVFile *)[self.commandDelegate getCommandInstance:@"File"]; + fs = [filePlugin filesystemForURL:sourceURL]; } if (fs) { __weak CDVFileTransfer* weakSelf = self; @@ -430,7 +431,8 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream) * Check here to see if it looks like the user passed in a raw filesystem path. (Perhaps they had the path saved, and were previously using it with the old version of File). If so, normalize it by removing empty path segments, and check with File to see if any of the installed filesystems will handle it. If so, then we will end up with a filesystem url to use for the remainder of this operation. */ target = [target stringByReplacingOccurrencesOfString:@"//" withString:@"/"]; - targetURL = [[self.commandDelegate getCommandInstance:@"File"] fileSystemURLforLocalPath:target].url; + CDVFile *filePlugin = (CDVFile *)[self.commandDelegate getCommandInstance:@"File"]; + targetURL = [filePlugin fileSystemURLforLocalPath:target].url; } else { targetURL = [NSURL URLWithString:target]; @@ -476,7 +478,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream) delegate.target = [targetURL absoluteString]; delegate.targetURL = targetURL; delegate.trustAllHosts = trustAllHosts; - delegate.filePlugin = [self.commandDelegate getCommandInstance:@"File"]; + delegate.filePlugin = (CDVFile *)[self.commandDelegate getCommandInstance:@"File"]; delegate.backgroundTaskID = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ [delegate cancelTransfer:delegate.connection]; }];