I'm trying to install this -- PhotoEditorSDK
, I followed the documentation exactly but keep getting 'PhotoEditorSDK/PhotoEditorSDK.h' file not found
error that causes build to be failed. Just to be clear, this is exactly how I tried to install this framework:
(1) Inside my ios folder, I run command pod init
(2) I edit my Podfile
like so:
platform :ios, '9.0'
target 'nearbie' do
pod 'PhotoEditorSDK'
end
(3) Run pod install
command
(4) This is what my .xcworkspace
looks like after step (3), and I also created PESDKModule.h
& PESDKModule.m
files as well as draged ios_license
license file there, as circled in the picture:
(5) The content of PESDKModule.h
& PESDKModule.m
are copied from demo app's .xcworkspace
file like this:
PESDKModule.h:
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>
@interface PESDKModule : RCTEventEmitter <RCTBridgeModule>
@end
PESDKModule.m:
#import "PESDKModule.h"
#import <React/RCTUtils.h>
#import <PhotoEditorSDK/PhotoEditorSDK.h>
@interface PESDKModule () <PESDKPhotoEditViewControllerDelegate>
@end
@implementation PESDKModule
RCT_EXPORT_MODULE(PESDK);
RCT_EXPORT_METHOD(present:(NSString *)path) {
PESDKPhotoEditViewController *photoEditViewController =
[[PESDKPhotoEditViewController alloc] initWithData:[NSData dataWithContentsOfFile:path] configuration:[[PESDKConfiguration alloc] init]];
photoEditViewController.delegate = self;
UIViewController *currentViewController = RCTPresentedViewController();
dispatch_async(dispatch_get_main_queue(), ^{
[currentViewController presentViewController:photoEditViewController animated:YES completion:NULL];
});
}
#pragma mark - IMGLYPhotoEditViewControllerDelegate
- (void)photoEditViewController:(PESDKPhotoEditViewController *)photoEditViewController didSaveImage:(UIImage *)image imageAsData:(NSData *)data {
[photoEditViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{
[self sendEventWithName:@"PhotoEditorDidSave" body:@{ @"image": [UIImageJPEGRepresentation(image, 1.0) base64EncodedStringWithOptions: 0], @"data": [data base64EncodedStringWithOptions:0] }];
}];
}
- (void)photoEditViewControllerDidCancel:(PESDKPhotoEditViewController *)photoEditViewController {
[photoEditViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{
[self sendEventWithName:@"PhotoEditorDidCancel" body:@{}];
}];
}
- (void)photoEditViewControllerDidFailToGeneratePhoto:(PESDKPhotoEditViewController *)photoEditViewController {
[self sendEventWithName:@"PhotoEditorDidFailToGeneratePhoto" body:@{}];
}
#pragma mark - RCTEventEmitter
- (NSArray<NSString *> *)supportedEvents {
return @[ @"PhotoEditorDidSave", @"PhotoEditorDidCancel", @"PhotoEditorDidFailToGeneratePhoto" ];
}
@end
But when I try to build the project, I get error like this (located inside PESDKModule.m
file):
I'm not sure about the use of Cocoapods within React Native. Our demo used the manual installation steps, described in our docs. Could you try linking the PhotoEditor SDK using these steps instead of Cocoapods?