Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

task cancelled issue due to improper type casting #513

Merged
merged 2 commits into from
Sep 12, 2017

Conversation

GaborWnuk
Copy link

Hello!

First of all - thank you for this excellent library and an amazing job!

I've faced slight problem with 0.10.9 branch - when i've tried to fetch multiple assets on my list view, all requests failed due to task cancelled error even though there was no such event.

I've checked Objective-C implementation and found out there is an issue with type casting in RNFetchBlobNetwork.m:

BOOL isCancelled = [taskSession valueForKey:@"isCancelled"];

NSLog(@"%@", taskSession);
NSLog(@"%d", isCancelled);
if(isCancelled) {
    errMsg = @"task cancelled";
}

NSLog(@"%@", errMsg);

which resulted in:

2017-09-08 14:49:40.266 Pudelek[57084:957459] {
    isCancelled = 0;
    session = "<__NSCFLocalDataTask: 0x7ffd313161c0>{ taskIdentifier: 1 } { completed }";
}
2017-09-08 14:49:40.266 Pudelek[57084:957459] 1
2017-09-08 14:49:40.267 Pudelek[57084:957459] "task cancelled"

This simple pull requests fixed the problem for me.

Resulted in `errMsg = "task cancelled"` even though isCancelled was "0".
@wkh237 wkh237 merged commit 4205ebc into wkh237:0.10.9 Sep 12, 2017
danielsuo added a commit to danielsuo/react-native-fetch-blob that referenced this pull request Feb 13, 2018
* upstream/0.10.9:
  Fixed problem with type casting (wkh237#513)
  My proposed 0.10.9 changes (wkh237#489)
  wkh237#268 Cancelled task should not trigger `then` promise function
  Add ability to cancel android DownloadManager fetches (wkh237#502)
  Fix iOS initialization race condition (wkh237#499)
  prevent UIApplication methods from being called on background thread (wkh237#486)
  Implemenet fs.hash() -- wkh237#439 "Feature: Calculate file hash" (wkh237#476)
  I forgot one error string for the Android readFile() method (wkh237#475)
  Fix for wkh237#467 (wkh237#472)
  Fix for issue wkh237#468, wkh237#461, wkh237#460 and minor cleanup (wkh237#469)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants