相关疑难解决方法(0)

如何从React Native应用程序打开iOS画廊应用程序

我无法从React Native应用程序打开iOS画廊应用程序。我有文件网址和资产网址。我从CameraRoll获取了资源网址。现在,我想打开图库本身以查看图像。

这是我使用的代码

openGallery = () => {
// this code is working on android using asset url
// sample url on iOS
// file url : file:///var/mobile/Containers/Data/Application/A41FFC2E-06D4-445D-9B94-D21E885930C7/Documents/video/popcam-1527202811.mov
// asset url : assets-library://asset/asset.mov?id=D4C62335-EDB1-4A75-B94D-61C3D48CADEA&ext=mov
const { galleryUrl, source } = this.props
const url = Platform.OS === 'ios' ? source : galleryUrl
Linking.canOpenURL(url).then(canOpen => {
  if (canOpen) {
    Linking.openURL(url)
  } else {
    Alert.alert('Info', 'Under Development')
  }
})
Run Code Online (Sandbox Code Playgroud)

谢谢

deep-linking ios camera-roll react-native react-native-ios

4
推荐指数
2
解决办法
927
查看次数