ios - 在React Native中获取``PhotoEditorSDK/PhotoEditorSDK.h''文件未找到错误

标签 ios objective-c reactjs react-native photoeditorsdk

我正在尝试安装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)这是步骤(3)之后我的.xcworkspace的样子,并且我还在其中创建了PESDKModule.hPESDKModule.m文件以及拖动的ios_license许可证文件,如图中圆圈所示:

enter image description here

(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文件中):

enter image description here

最佳答案

我不确定在React Native中使用Cocoapods。我们的演示使用了our docs中描述的手动安装步骤。您可以尝试使用以下步骤而不是Cocoapods链接PhotoEditor SDK吗?

关于ios - 在React Native中获取``PhotoEditorSDK/PhotoEditorSDK.h''文件未找到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48727899/

相关文章:

ios - 在 iOS6.0 上使用 FBNativeDialogs 发布到 facebook 时不一致的崩溃

ios - iOS7,向后兼容并启动图像

ios - 无粘贴:canPerformAction:withSender中的操作:

iphone - Xcode - 如何循环 UIAlert (带有文本字段)直到输入正确的值?

ios - 如何向 UISearchController 添加间隙?

javascript - 无法在 react 组件中设置状态

reactjs - 自定义历史记录不起作用的 react 路由器

javascript - 使用参数从 firebase 查询数据 - React

iphone - 在游戏中心重新连接玩家

ios - 从 View 过渡 :toView:duration:options:completion: confusion