1

pod install我正在按照 React Native Image Picker 的说明进行操作,但我对是否应该运行感到困惑react-native link

https://github.com/react-community/react-native-image-picker#install

据我所知,它将这一行添加到 podfile

pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker

它似乎没有链接 iOS Xcode 项目中的任何其他内容,也没有连接或链接 xcode 项目中的任何其他内容。

在 react 本机代码中调用 ImagePicker 会导致运行时错误

cannot read property 'showImagePicker' of undefined error when calling ImagePicker.showImagePicker(options)

ImagePicker 和 showImagePicker 是在 javascript 运行时定义的,所以我认为错误来自 ios 方面。

作为替代方案,我尝试在之后运行 pod install ,但出现构建错误,找不到响应库的标头。

4

1 回答 1

0

You basically have two options, either use react-native link or use cocoapods. react-native link will link the framework to both IOS and Android. If you decide to use cocoapods it's only for IOS.

于 2018-04-21T07:12:05.120 回答