【发布时间】:2021-04-04 11:11:54
【问题描述】:
我正在使用 @react-native-community/cameraroll 库从相机胶卷上传视频。为此,我使用了 getPhotos 函数。但是,使用此函数会导致以下错误:
null is not an object (evaluating '_nativeInterface.default.getPhotos')
我调用getPhotos函数如下:
<Pressable onPress={() => {
CameraRoll.getPhotos({first:10});
}}
style={({ pressed }) => [{
backgroundColor: pressed ? 'white' : '#03befc'
},
styles.upload]}>
<Text style={styles.uploadText}>Upload Video</Text></Pressable>
像我在 Pressable 组件的 onPress 事件中那样调用相机胶卷有什么问题,它给了我我提到的错误?
是的,我已经添加了键和字符串
<key>NSPhotoLibraryUsageDescription</key>
<string>Our application needs permission to write photos...</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Our application needs permission to write photos...</string>
但我仍然收到错误消息。
【问题讨论】:
-
你的设备是什么?
-
iPhone 11 模拟器
-
你授权了吗?
-
如何给它权限?
-
在
Info.plist文件中