在 React Native 中获取 'PhotoEditorSDK/PhotoEditorSDK.h' 找不到文件错误
Getting 'PhotoEditorSDK/PhotoEditorSDK.h' file not found' error in react native
我正在尝试安装 this -- PhotoEditorSDK
,我完全按照文档进行操作,但不断收到 'PhotoEditorSDK/PhotoEditorSDK.h' file not found
导致构建失败的错误。需要说明的是,这正是我尝试安装此框架的方式:
(1) 在我的 ios 文件夹中,我 运行 命令 pod init
(2) 我这样编辑 Podfile
:
platform :ios, '9.0'
target 'nearbie' do
pod 'PhotoEditorSDK'
end
(3) 运行 pod install
命令
(4) 这是我的 .xcworkspace
在步骤 (3) 之后的样子,我还创建了 PESDKModule.h
和 PESDKModule.m
文件以及拖动 ios_license
许可证文件在那里,如图中圈出:
(5) PESDKModule.h
和 PESDKModule.m
的内容是从演示应用程序的 .xcworkspace
文件中复制的,如下所示:
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
但是当我尝试构建项目时,出现这样的错误(位于 PESDKModule.m
文件中):
我不确定在 React Native 中使用 Cocoapods。我们的演示使用 our docs 中描述的手动安装步骤。您可以尝试使用这些步骤而不是 Cocoapods 链接 PhotoEditor SDK 吗?
我正在尝试安装 this -- PhotoEditorSDK
,我完全按照文档进行操作,但不断收到 'PhotoEditorSDK/PhotoEditorSDK.h' file not found
导致构建失败的错误。需要说明的是,这正是我尝试安装此框架的方式:
(1) 在我的 ios 文件夹中,我 运行 命令 pod init
(2) 我这样编辑 Podfile
:
platform :ios, '9.0'
target 'nearbie' do
pod 'PhotoEditorSDK'
end
(3) 运行 pod install
命令
(4) 这是我的 .xcworkspace
在步骤 (3) 之后的样子,我还创建了 PESDKModule.h
和 PESDKModule.m
文件以及拖动 ios_license
许可证文件在那里,如图中圈出:
(5) PESDKModule.h
和 PESDKModule.m
的内容是从演示应用程序的 .xcworkspace
文件中复制的,如下所示:
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
但是当我尝试构建项目时,出现这样的错误(位于 PESDKModule.m
文件中):
我不确定在 React Native 中使用 Cocoapods。我们的演示使用 our docs 中描述的手动安装步骤。您可以尝试使用这些步骤而不是 Cocoapods 链接 PhotoEditor SDK 吗?