1

我跟着自述從react-native-image-picker與手動和自動連接(分別審判兩者)。陣營本機圖像選取器:「未定義不是(評價‘ImagePickerManager.showImagePicker’)的對象」

當我使用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 
+0

你這樣做:'VAR ImagePickerManager =需要(」反應,原生影像選擇器');'? – Cherniv

+0

我使用了'react-native-image-picker'這個例子''import import ImagePicker;'''我剛剛試過了你的版本,並且得到了同樣的錯誤 –

+0

好吧,把它改成:'import ImagePickerManager from 'react-native-image-picker';' – Cherniv

回答

0

看來,Xcode中沒有正確連接的文件,誰對我工作的訣竅是:

  1. 打開Xcode項目 'MainProject.xcodeproj'
  2. 在MainProject下的庫我會去找RNImagePicker.xcodeproj
  3. 根據RNImagePicker.xcodeproj我會右擊並刪除這兩個文件ImagePickerManag er.h和ImagePickerManager.m
  4. 右鍵單擊RNImagePicker.xocdeproj將'Add files to ...',然後從'node_modules/react-native-maps/ios/ImagePickerManager.h和ImagePickerManganer.m中選擇兩個文件「

希望它可以幫助誰可能有同樣的問題別人;)

+0

嗨。我的應用沒有react-native-maps文件夾。我應該安裝它還是錯過任何東西? – chiquyet

相關問題