fix(lib) build error in RNCCameraRollManager.m (#109)

After upgrading to 1.3.0 that includes #87, my builds started to fail on the step to link react-native-cameraroll with the following message:
`Undefined symbol: _OBJC_Class_$_RCTImageLoader`.

I'm not sure what @tomtargosz's environment is like that allowed this to work, but it does not seem to work in 0.61.x with autolinked (cocoapods) dependencies. It looks like the recommendation made in that file is incorrect. 

The correct way to fix this, which I see in [react-native-image-crop-picker](https://github.com/ivpusic/react-native-image-crop-picker/blob/master/ios/src/ImageCropPicker.m#L394) and in [several](https://github.com/facebook/react-native/blob/master/Libraries/Image/RCTImageEditingManager.mm#L60) [internal](https://github.com/facebook/react-native/blob/master/Libraries/Image/RCTImageView.m#L324) [react files](@implementation RCTImageViewManager), is to use `[self.bridge moduleForName:@"ImageLoader" lazilyLoadIfNecessary:YES]`.
This commit is contained in:
Zach Ramos 2019-11-14 12:22:32 -05:00 committed by Bartol Karuza
parent 11476ebe14
commit 03bc028efe
1 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@
#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
#import <React/RCTImageLoader.h>
#import <React/RCTImageLoaderProtocol.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
@ -176,7 +176,7 @@ RCT_EXPORT_METHOD(saveToCameraRoll:(NSURLRequest *)request
inputURI = request.URL;
saveWithOptions();
} else {
[[self->_bridge moduleForClass:[RCTImageLoader class]] loadImageWithURLRequest:request callback:^(NSError *error, UIImage *image) {
[[self.bridge moduleForName:@"ImageLoader" lazilyLoadIfNecessary:YES] loadImageWithURLRequest:request callback:^(NSError *error, UIImage *image) {
if (error) {
reject(kErrorUnableToLoad, nil, error);
return;