从Detox中的react-native-image-picker模拟文件时,如何使用相对路径?

问题描述

我能够使用完整路径模拟拾取的图像,但是在iOS模拟器中模拟我的应用程序时,无法使用相对路径。

我认为我需要在构建后解决该路径,但不确定如何做到这一点。

这是我的ImagePicker.e2e.js文件中的内容:

ImagePicker.launchImageLibrary = function showImagePicker(options,callback) {
  if (typeof options === 'function') {
    callback = options;
  }
  callback({
    success: true,origURL: 'www.test.com',path: '/Users/MyUserName/Documents/GitHub/MyRepoName/e2e/media/test.jpg',// This works
    type: 'image/jpeg',fileName: 'test.jpg',fileSize: 4000,});
};
如果我将路径设置为'../../e2e/media/test.jpg',则找不到图像文件。这是我的仓库中图像文件的正确相对路径。

在我的Detox构建配置中可以找到: "build": "xcodebuild -workspace ios/ProjectName.xcworkspace -scheme ProjectName -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build"

derivedDataPath是否用于解析相对路径文件?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...