Skip to content

Commit

Permalink
Merge pull request #116 from BaderSerhan/fix/cancelUpload
Browse files Browse the repository at this point in the history
fix cancelUpload not working
  • Loading branch information
StevePotter committed Jan 3, 2019
2 parents 46d8a36 + ddbe25b commit f098d0c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ios/VydiaRNFileUploader.m
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ - (void)copyAssetToFile: (NSString *)assetUrl completionHandler: (void(^)(NSStri
RCT_EXPORT_METHOD(cancelUpload: (NSString *)cancelUploadId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
[_urlSession getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
for (NSURLSessionTask *uploadTask in uploadTasks) {
if (uploadTask.taskDescription == cancelUploadId) {
if ([uploadTask.taskDescription isEqualToString:cancelUploadId]){
// == checks if references are equal, while isEqualToString checks the string value
[uploadTask cancel];
}
}
Expand Down

0 comments on commit f098d0c

Please sign in to comment.