React-native-image-crop-picker: Linking fails in a Xcode Project, where React Native was deployed through cocoapods

Created on 23 Mar 2017  路  10Comments  路  Source: ivpusic/react-native-image-crop-picker

I have following packages in my react native project:

  • react-native-image-crop-picker v0.12.8
  • react-native v0.42.3

I am integrating the react native into an existing XCode project, in order to do that I am using the following PodFile:

# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'

target 'Unity-iPhone' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  react_native_path = "../node_modules/react-native"
  yoga_path = File.join(react_native_path, 'ReactCommon/yoga')

  pod "Yoga", :path => yoga_path
  pod "React", :path => react_native_path, :subspecs => [
    'jschelpers',
    'cxxreact',
    'ART',
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTVibration',
    'RCTPushNotification',
    'RCTText',
    'RCTWebSocket'
  ]

  pod "RSKImageCropper"
  pod "QBImagePickerController", :path => "../node_modules/react-native-image-crop-picker/ios/QBImagePicker"

end

After I run "react-native link", it adds a reference to the ImageCropPicker project file, but it is marked as missing in my project. If I try to build my project, it fails with a linking error. If I just add a reference to the same project manually, it fails to find a reference to the React Native.

Can you suggest any way of adding your library in a XCode project that has react native deployed through cocoapods?

Thanks!

Most helpful comment

If the project uses CocoaPods be aware to always open the .xcworkspace file instead of the .xcodeproj file.

All 10 comments

just follow installation steps from readme. I am also using cocoapods and it should work without problems just with installation steps from readme.

I did everything exactly as you described in the readme, but still something is missing, can't understand how to link your plugin correctly to a project that uses React Native cocoapods.

I ended up adding source .h and .m files from your plugin directly to my main project and it worked, but it is not the solution I prefer.

can you do a "git diff ios/Pillar.xcodeproj/project.pbxproj" after react-native link?

I encountered the same problem. In my case, it's this line that broke the xcode project file:

HEADER_SEARCH_PATHS = "$(SRCROOT)/../node_modules/react-native/Libraries/PushNotificationIOS/**""$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**";

I manually edit ios/Pillar.xcodeproj/project.pbxproj and change it to:

HEADER_SEARCH_PATHS = (
    "$(inherited)",
    "$(SRCROOT)/../node_modules/react-native/Libraries/PushNotificationIOS/**",
    "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
);
HEADER_SEARCH_PATHS = (
  "$(inherited)",
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
  "$(SRCROOT)/../node_modules/react-native-fcm/ios/**",
  "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**",
  "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager/**",
);

I have this and it still fails on not finding React/RCTBridgeModel.h.

@yurykorzun ,I got the same mistake, and what do you mean 'adding source .h and .m files from your plugin directly'? Thanks!

Thanks! @yurykorzun I know the way you said, just drag Compression and ImageCropPicker( .h and .m ) and group UIImage-Resize to our main project, not link. it works well.

Seems like a similar issue?

Only included the following to my podfile

  pod 'RSKImageCropper'
  pod 'QBImagePickerController'

RCTBridge

image

@poyannabati have you been able to figure this out? Running into the same issue right now ...

@tspecht Check #372. You can use my fork for now, I'll try to do what's necessary to get it merged.

If the project uses CocoaPods be aware to always open the .xcworkspace file instead of the .xcodeproj file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

equesteo picture equesteo  路  3Comments

DISKONEKTeD picture DISKONEKTeD  路  3Comments

tximpa91 picture tximpa91  路  3Comments

xuchao321 picture xuchao321  路  3Comments

phantom1299 picture phantom1299  路  3Comments