iOS: Fix dequeueTasks crash in image loader
iOS: Fix dequeueTasks crash in image loader

Summary:
This fixes a crash occurring [on this line](https://github.com/facebook/react-native/blob/f9f32eb426b5385e199ef6e1d2b610dfe20e60e7/Libraries/Image/RCTImageLoader.m#L253). It was reported in a comment in #10433.

The problem is that `task` is deallocated at this point and is unsafe to use. Removing it from `_pendingTasks` dropped its ref count to 0. [The ARC docs](http://clang.llvm.org/docs/AutomaticReferenceCounting.html#fast-enumeration-iteration-variables) state that, by default, loop variables in fast enumeration loops are not retained. That's why `task`'s ref count is 0.

It's likely we ran into this bug because the code disobeyed the [reverseObjectEnumerator docs](https://developer.apple.com/reference/foundation/nsarray/1415734-reverseobjectenumerator) which state that "you must not modify the array during enumeration". The default retention policy for fast enumeration seems to assume you follow this.

To fix this bug and avoid other potential pitfalls, the code now follows the docs and `_pendingTa
Closes https://github.com/facebook/react-native/pull/11296

Differential Revision: D4277167

Pulled By: javache

fbshipit-source-id: 1211b32935bab7f4080dc00b88d85348786e859a

exponent/react-native,eduardinni/react-native,ndejesus1227/react-native,tadeuzagallo/react-native,imjerrybao/react-native,PlexChat/react-native,Maxwell2022/react-native,shrutic123/react-native,cdlewis/react-native,satya164/react-native,dikaiosune/react-native,jevakallio/react-native,mironiasty/react-native,mironiasty/react-native,Maxwell2022/react-native,cpunion/react-native,frantic/react-native,imDangerous/react-native,jasonnoahchoi/react-native,DanielMSchmidt/react-native,shrutic/react-native,ptmt/react-native-macos,hoastoolshop/react-native,Ehesp/react-native,ndejesus1227/react-native,Ehesp/react-native,PlexChat/react-native,gilesvangruisen/react-native,shrutic/react-native,aljs/react-native,farazs/react-native,salanki/react-native,brentvatne/react-native,frantic/react-native,aljs/react-native,javache/react-native,esauter5/react-native,cdlewis/react-native,janicduplessis/react-native,ptmt/react-native-macos,tadeuzagallo/react-native,alin23/react-native,imDangerous/react-native,Guardiannw/react-native,facebook/react-native,aljs/react-native,hoastoolshop/react-native,ptmt/react-native-macos,thotegowda/react-native,Ehesp/react-native,alin23/react-native,satya164/react-native,cpunion/react-native,hoangpham95/react-native,Bhullnatik/react-native,tadeuzagallo/react-native,Bhullnatik/react-native,exponentjs/react-native,tsjing/react-native,clozr/react-native,aljs/react-native,Andreyco/react-native,rickbeerendonk/react-native,callstack-io/react-native,eduardinni/react-native,callstack-io/react-native,shrutic/react-native,salanki/react-native,tszajna0/react-native,Andreyco/react-native,Purii/react-native,Guardiannw/react-native,myntra/react-native,htc2u/react-native,makadaw/react-native,negativetwelve/react-native,janicduplessis/react-native,shrutic/react-native,skevy/react-native,forcedotcom/react-native,Maxwell2022/react-native,Livyli/react-native,PlexChat/react-native,ankitsinghania94/react-native,ptmt/react-native-macos,clozr/react-native,lprhodes/react-native,makadaw/react-native,negativetwelve/react-native,pandiaraj44/react-native,htc2u/react-native,clozr/react-native,makadaw/react-native,doochik/react-native,cpunion/react-native,jadbox/react-native,shrutic123/react-native,skevy/react-native,doochik/react-native,imDangerous/react-native,exponent/react-native,htc2u/react-native,DannyvanderJagt/react-native,tszajna0/react-native,clozr/react-native,kesha-antonov/react-native,chnfeeeeeef/react-native,satya164/react-native,cdlewis/react-native,myntra/react-native,CodeLinkIO/react-native,imDangerous/react-native,imjerrybao/react-native,mironiasty/react-native,ndejesus1227/react-native,DanielMSchmidt/react-native,Andreyco/react-native,htc2u/react-native,DannyvanderJagt/react-native,orenklein/react-native,Bhullnatik/react-native,DanielMSchmidt/react-native,ankitsinghania94/react-native,shrutic/react-native,esauter5/react-native,Ehesp/react-native,facebook/react-native,tadeuzagallo/react-native,javache/react-native,peterp/react-native,hammerandchisel/react-native,jadbox/react-native,javache/react-native,ankitsinghania94/react-native,shrutic123/react-native,ptomasroos/react-native,gilesvangruisen/react-native,javache/react-native,jasonnoahchoi/react-native,doochik/react-native,chnfeeeeeef/react-native,adamjmcgrath/react-native,imjerrybao/react-native,jasonnoahchoi/react-native,cdlewis/react-native,jevakallio/react-native,callstack-io/react-native,rickbeerendonk/react-native,kesha-antonov/react-native,doochik/react-native,hoastoolshop/react-native,formatlos/react-native,brentvatne/react-native,mironiasty/react-native,DanielMSchmidt/react-native,Livyli/react-native,exponent/react-native,Maxwell2022/react-native,orenklein/react-native,ptomasroos/react-native,chnfeeeeeef/react-native,adamjmcgrath/react-native,arthuralee/react-native,chnfeeeeeef/react-native,ptmt/react-native-macos,imjerrybao/react-native,gilesvangruisen/react-native,salanki/react-native,Livyli/react-native,thotegowda/react-native,salanki/react-native,tadeuzagallo/react-native,farazs/react-native,clozr/react-native,frantic/react-native,kesha-antonov/react-native,hammerandchisel/react-native,skevy/react-native,ndejesus1227/react-native,myntra/react-native,CodeLinkIO/react-native,tsjing/react-native,hammerandchisel/react-native,csatf/react-native,Ehesp/react-native,Swaagie/react-native,Livyli/react-native,formatlos/react-native,negativetwelve/react-native,ptomasroos/react-native,rickbeerendonk/react-native,lprhodes/react-native,formatlos/react-native,lprhodes/react-native,lprhodes/react-native,forcedotcom/react-native,jadbox/react-native,PlexChat/react-native,myntra/react-native,javache/react-native,charlesvinette/react-native,pandiaraj44/react-native,shrutic123/react-native,myntra/react-native,frantic/react-native,makadaw/react-native,cdlewis/react-native,PlexChat/react-native,DannyvanderJagt/react-native,aljs/react-native,happypancake/react-native,eduardinni/react-native,brentvatne/react-native,dikaiosune/react-native,thotegowda/react-native,chnfeeeeeef/react-native,orenklein/react-native,ankitsinghania94/react-native,hammerandchisel/react-native,gilesvangruisen/react-native,kesha-antonov/react-native,lprhodes/react-native,rickbeerendonk/react-native,DannyvanderJagt/react-native,alin23/react-native,exponentjs/react-native,ndejesus1227/react-native,peterp/react-native,Maxwell2022/react-native,formatlos/react-native,hoangpham95/react-native,Purii/react-native,shrutic/react-native,hoangpham95/react-native,Livyli/react-native,chnfeeeeeef/react-native,alin23/react-native,doochik/react-native,DanielMSchmidt/react-native,lprhodes/react-native,Ehesp/react-native,CodeLinkIO/react-native,callstack-io/react-native,janicduplessis/react-native,tszajna0/react-native,adamjmcgrath/react-native,Swaagie/react-native,doochik/react-native,exponent/react-native,csatf/react-native,mironiasty/react-native,CodeLinkIO/react-native,jasonnoahchoi/react-native,tadeuzagallo/react-native,ptomasroos/react-native,Swaagie/react-native,makadaw/react-native,esauter5/react-native,Purii/react-native,hoangpham95/react-native,jevakallio/react-native,hoangpham95/react-native,imjerrybao/react-native,Livyli/react-native,kesha-antonov/react-native,hammerandchisel/react-native,javache/react-native,pandiaraj44/react-native,hoangpham95/react-native,hammerandchisel/react-native,Purii/react-native,Bhullnatik/react-native,ptomasroos/react-native,exponentjs/react-native,jasonnoahchoi/react-native,jadbox/react-native,peterp/react-native,negativetwelve/react-native,cpunion/react-native,exponentjs/react-native,doochik/react-native,brentvatne/react-native,happypancake/react-native,exponentjs/react-native,dikaiosune/react-native,rickbeerendonk/react-native,happypancake/react-native,cdlewis/react-native,callstack-io/react-native,imjerrybao/react-native,salanki/react-native,kesha-antonov/react-native,charlesvinette/react-native,rickbeerendonk/react-native,Bhullnatik/react-native,javache/react-native,tszajna0/react-native,csatf/react-native,Swaagie/react-native,clozr/react-native,shrutic123/react-native,janicduplessis/react-native,skevy/react-native,orenklein/react-native,Guardiannw/react-native,Andreyco/react-native,tszajna0/react-native,ankitsinghania94/react-native,tsjing/react-native,hammerandchisel/react-native,cdlewis/react-native,alin23/react-native,dikaiosune/react-native,tsjing/react-native,happypancake/react-native,callstack-io/react-native,PlexChat/react-native,satya164/react-native,jevakallio/react-native,janicduplessis/react-native,esauter5/react-native,exponent/react-native,imDangerous/react-native,alin23/react-native,arthuralee/react-native,thotegowda/react-native,pandiaraj44/react-native,farazs/react-native,makadaw/react-native,imDangerous/react-native,Purii/react-native,jadbox/react-native,arthuralee/react-native,hoastoolshop/react-native,callstack-io/react-native,brentvatne/react-native,salanki/react-native,farazs/react-native,Guardiannw/react-native,frantic/react-native,dikaiosune/react-native,satya164/react-native,farazs/react-native,lprhodes/react-native,mironiasty/react-native,tsjing/react-native,ankitsinghania94/react-native,Bhullnatik/react-native,forcedotcom/react-native,shrutic123/react-native,forcedotcom/react-native,esauter5/react-native,charlesvinette/react-native,Andreyco/react-native,PlexChat/react-native,facebook/react-native,mironiasty/react-native,htc2u/react-native,rickbeerendonk/react-native,eduardinni/react-native,chnfeeeeeef/react-native,ptmt/react-native-macos,ankitsinghania94/react-native,arthuralee/react-native,facebook/react-native,skevy/react-native,happypancake/react-native,ptmt/react-native-macos,mironiasty/react-native,dikaiosune/react-native,pandiaraj44/react-native,myntra/react-native,PlexChat/react-native,esauter5/react-native,Ehesp/react-native,javache/react-native,rickbeerendonk/react-native,facebook/react-native,happypancake/react-native,charlesvinette/react-native,tsjing/react-native,jadbox/react-native,imjerrybao/react-native,DanielMSchmidt/react-native,cdlewis/react-native,jadbox/react-native,orenklein/react-native,shrutic/react-native,pandiaraj44/react-native,Swaagie/react-native,Guardiannw/react-native,thotegowda/react-native,jasonnoahchoi/react-native,aljs/react-native,jevakallio/react-native,shrutic123/react-native,Swaagie/react-native,peterp/react-native,thotegowda/react-native,doochik/react-native,adamjmcgrath/react-native,Bhullnatik/react-native,eduardinni/react-native,myntra/react-native,alin23/react-native,janicduplessis/react-native,dikaiosune/react-native,skevy/react-native,happypancake/react-native,brentvatne/react-native,charlesvinette/react-native,DanielMSchmidt/react-native,brentvatne/react-native,hammerandchisel/react-native,exponent/react-native,ptomasroos/react-native,CodeLinkIO/react-native,imjerrybao/react-native,salanki/react-native,ptomasroos/react-native,satya164/react-native,charlesvinette/react-native,negativetwelve/react-native,cpunion/react-native,jadbox/react-native,jevakallio/react-native,eduardinni/react-native,forcedotcom/react-native,clozr/react-native,tszajna0/react-native,DannyvanderJagt/react-native,negativetwelve/react-native,skevy/react-native,Swaagie/react-native,orenklein/react-native,jasonnoahchoi/react-native,ndejesus1227/react-native,Swaagie/react-native,Guardiannw/react-native,csatf/react-native,tadeuzagallo/react-native,imDangerous/react-native,formatlos/react-native,CodeLinkIO/react-native,cpunion/react-native,Purii/react-native,Ehesp/react-native,Guardiannw/react-native,adamjmcgrath/react-native,pandiaraj44/react-native,hoastoolshop/react-native,tsjing/react-native,hoastoolshop/react-native,Purii/react-native,satya164/react-native,tsjing/react-native,Maxwell2022/react-native,eduardinni/react-native,imDangerous/react-native,CodeLinkIO/react-native,kesha-antonov/react-native,farazs/react-native,csatf/react-native,peterp/react-native,esauter5/react-native,hoastoolshop/react-native,ptmt/react-native-macos,gilesvangruisen/react-native,kesha-antonov/react-native,gilesvangruisen/react-native,charlesvinette/react-native,forcedotcom/react-native,htc2u/react-native,orenklein/react-native,csatf/react-native,clozr/react-native,aljs/react-native,kesha-antonov/react-native,lprhodes/react-native,alin23/react-native,tszajna0/react-native,Maxwell2022/react-native,formatlos/react-native,formatlos/react-native,myntra/react-native,tszajna0/react-native,csatf/react-native,jevakallio/react-native,mironiasty/react-native,myntra/react-native,happypancake/react-native,doochik/react-native,exponent/react-native,cpunion/react-native,jasonnoahchoi/react-native,ankitsinghania94/react-native,hoastoolshop/react-native,salanki/react-native,exponentjs/react-native,shrutic123/react-native,Maxwell2022/react-native,Bhullnatik/react-native,ptomasroos/react-native,Guardiannw/react-native,pandiaraj44/react-native,rickbeerendonk/react-native,gilesvangruisen/react-native,brentvatne/react-native,facebook/react-native,cdlewis/react-native,negativetwelve/react-native,ndejesus1227/react-native,skevy/react-native,forcedotcom/react-native,cpunion/react-native,orenklein/react-native,makadaw/react-native,DannyvanderJagt/react-native,esauter5/react-native,Purii/react-native,ndejesus1227/react-native,shrutic/react-native,peterp/react-native,formatlos/react-native,gilesvangruisen/react-native,negativetwelve/react-native,negativetwelve/react-native,csatf/react-native,exponent/react-native,adamjmcgrath/react-native,DannyvanderJagt/react-native,Andreyco/react-native,tadeuzagallo/react-native,dikaiosune/react-native,brentvatne/react-native,thotegowda/react-native,formatlos/react-native,hoangpham95/react-native,satya164/react-native,facebook/react-native,peterp/react-native,farazs/react-native,Livyli/react-native,callstack-io/react-native,htc2u/react-native,farazs/react-native,hoangpham95/react-native,jevakallio/react-native,DanielMSchmidt/react-native,arthuralee/react-native,makadaw/react-native,exponentjs/react-native,facebook/react-native,adamjmcgrath/react-native,thotegowda/react-native,facebook/react-native,charlesvinette/react-native,eduardinni/react-native,janicduplessis/react-native,javache/react-native,farazs/react-native,adamjmcgrath/react-native,jevakallio/react-native,Andreyco/react-native,janicduplessis/react-native,makadaw/react-native,Andreyco/react-native,chnfeeeeeef/react-native,DannyvanderJagt/react-native,htc2u/react-native,peterp/react-native,forcedotcom/react-native,Livyli/react-native,exponentjs/react-native,CodeLinkIO/react-native,aljs/react-native