反应机图像选取器:“未定义不是(评价‘ImagePickerManager.showImagePic

2019-09-30 15:18发布

我从随后的自述反应本地图像选取器与手动和自动链接(尝试都分开)。

当我使用从终端发起模拟器react-native run-ios我得到的错误。 当从Xcode中启动它工作得很好,我可以访问CameraRoll选择器没有问题。

下面是我使用的版本:

"react-native": "0.43.3", "react-native-image-picker": "^0.26.3",

我看到了类似的主题在这里StackOverflow上 ,似乎我不是有这个问题的唯一一个。

感谢您的帮助。

完整的错误:

undefined is not an object (evaluating 'ImagePickerManager.showImagePicker')

showImagePicker
    index.js:28:30
selectPhotoTapped
    CamPick.js:31:32
touchableHandlePress
    TouchableOpacity.js:126:45
_performSideEffectsForTransition
    Touchable.js:746:34
_receiveSignal
    Touchable.js:664:44
touchableHandleResponderRelease
    Touchable.js:433:24
invokeGuardedCallback
    ReactErrorUtils.js:30:9
executeDispatch
    EventPluginUtils.js:99:42
executeDispatchesInOrder
    EventPluginUtils.js:127:20
executeDispatchesAndRelease
    EventPluginHub.js:37:46
forEachAccumulated
    forEachAccumulated.js:30:16
processEventQueue
    EventPluginHub.js:227:8
runEventQueueInBatch
    ReactEventEmitterMixin.js:18:35
handleTopLevel
    ReactEventEmitterMixin.js:38:25
<unknown>
    ReactNativeEventEmitter.js:113:8
perform
    Transaction.js:149:24
batchedUpdatesWithControlledComponents
    ReactGenericBatching.js:51:26
_receiveRootNodeIDEvent
    ReactNativeEventEmitter.js:111:40
receiveTouches
    ReactNativeEventEmitter.js:200:8
__callFunction
    MessageQueue.js:244:47
<unknown>
    MessageQueue.js:108:26
guard
    MessageQueue.js:46:4
callFunctionReturnFlushedQueue
    MessageQueue.js:107:10

Answer 1:

It seemed that Xcode was not linking the files properly, the trick who worked for me was to:

  1. Open Xcode project 'MainProject.xcodeproj'
  2. Under MainProject under Libraries I would go find RNImagePicker.xcodeproj
  3. Under RNImagePicker.xcodeproj I would right click and delete both files ImagePickerManager.h and ImagePickerManager.m
  4. Right click on RNImagePicker.xocdeproj to 'Add files to ...' and then would select both files from 'node_modules/react-native-maps/ios/ImagePickerManager.h and ImagePickerManganer.m'

Hope it helps somebody who might have the same problem ;)



文章来源: React Native Image Picker: “undefined is not an object (evaluating 'ImagePickerManager.showImagePicker')”