callstack / react-native-image-editor

A library providing an API for cropping images from the web and the local file system.
MIT License
376 stars 118 forks source link

'RCTImageUtils.h' file not found #32

Closed adamhari closed 5 years ago

adamhari commented 5 years ago

Bug

Trying to build my project in Xcode after having linked this library. Getting a "'RCTImageUtils.h' file not found" build error.

Environment info

React native info output:

React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
      Memory: 221.55 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.14.1 - /usr/local/bin/node
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 27.0.3, 28.0.3
        System Images: android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5314842
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.10 => 0.59.10 
    npmGlobalPackages:
      react-native-cli: 2.0.1

Library version: 2.0.0

Steps To Reproduce

  1. install this lib
  2. run react-native link @react-native-community/image-editor
  3. open Xcode, navigate to Product --> Build

Describe what you expected to happen:

  1. the project successfully builds

Notes

I think the problem is that, in RNCImageEditor.m, line 20's if/else is falling back to the else even when RCTImage/RCTImageUitls exists in the project (where RCTImage.xcodeproj is a sibling to RNCImageEditor.xcodeproj)

image

kevincantstop commented 5 years ago

I think ImageEditor now is a built-in component. You can simply import ImageEditor from react https://facebook.github.io/react-native/docs/imageeditor

e.g

import { ImageEditor } from 'react-native'

Trancever commented 5 years ago

@kevincantstop It is, but it's going to be removed soon. This library should be used as a replacement.

Trancever commented 5 years ago

@adamhari Do you still have an issue?

kevincantstop commented 5 years ago

@Trancever I yarn add this repo and the issue still exists

adamhari commented 5 years ago

@adamhari Do you still have an issue?

yes

kevincantstop commented 5 years ago

Also there's another problem on iOS, if I call ImageEditor.cropImage, it says:

no such file or directory, open 'rct-image-store//0' so it causes cropping process failure. I have already added perms to plist.

`

NSPhotoLibraryUsageDescription Photo Library Usage Is Required NSPhotoLibraryAddUsageDescription Photo Library Addition Is Required

`

I'm new to iOS, any suggestions could help. :) Thanks in advance.

react-native: 0.60.3

Trancever commented 5 years ago

@kevincantstop I am pretty sure you're using v1 of image-editor. Can you try v2.0.1 ? We no longer use image-store under the hood.

acro5piano commented 5 years ago

For me the following patch works.

diff --git a/node_modules/@react-native-community/image-editor/ios/RNCImageEditor.xcodeproj/project.pbxproj b/node_modules/@react-native-community/image-editor/ios/RNCImageEditor.xcodeproj/project.pbxproj
index 9e121f3..8336d35 100755
--- a/node_modules/@react-native-community/image-editor/ios/RNCImageEditor.xcodeproj/project.pbxproj
+++ b/node_modules/@react-native-community/image-editor/ios/RNCImageEditor.xcodeproj/project.pbxproj
@@ -220,6 +220,7 @@
                    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
                    "$(SRCROOT)/../../../React/**",
                    "$(SRCROOT)/../../react-native/React/**",
+                   "$(SRCROOT)/../../../react-native/Libraries/**",
                );
                LIBRARY_SEARCH_PATHS = "$(inherited)";
                OTHER_LDFLAGS = "-ObjC";
@@ -236,6 +237,7 @@
                    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
                    "$(SRCROOT)/../../../React/**",
                    "$(SRCROOT)/../../react-native/React/**",
+                   "$(SRCROOT)/../../../react-native/Libraries/**",
                );
                LIBRARY_SEARCH_PATHS = "$(inherited)";
                OTHER_LDFLAGS = "-ObjC";
Trancever commented 5 years ago

@adamhari Can you provide repo that reproduces issue? I tried same version of React-Native + manual link and it worked fine.

RadiRS commented 5 years ago

has any one fix this issue ?

Trancever commented 5 years ago

@RadiRS If you still experience the issue can you write what version of react-native, image-editor do you use and how do you link them?

adamhari commented 5 years ago

@Trancever react-native@0.59.10, react-native-image-editor@2.0.1. Can't provide a reproducible repo at the moment, will try to find time this weekend

tuledev commented 5 years ago

I'm getting the same error.

asrytis commented 5 years ago

Same here. The lib is linked manually, ie. not using Cocoa Pods. react-native@0.59.9, react-native-image-editor@2.0.1

Edit: fixed by adding the following to RNCImageEditor.xcodeproj header search paths: $(SRCROOT)/../../../react-native/Libraries/Image

Trancever commented 5 years ago

The fix is included into v2.0.2. Let me know if it works for you!