【问题标题】:added new video file is removed when simulator is relaunched重新启动模拟器时删除添加的新视频文件
【发布时间】:2016-08-21 13:42:00
【问题描述】:

我面临一个问题。我的环境是:

OSX 10.10.5 YOsemite
xocde 7.2

我想在我的 ios 模拟器中添加一个新的视频文件 (.mp4)。我在

中添加了这个
 /Users/mynane/Library/Developer/CoreSimulator/Devices/mydevice/data/Media/DCIM/100APPLE

添加此内容后,当我重新启动模拟器时,未显示添加的视频。它只显示之前添加的默认图像。

我也删了

 photoData 

但结果相同。

我该如何解决这个问题?

【问题讨论】:

    标签: iphone ios7 ios-simulator osx-yosemite xcode7.2


    【解决方案1】:

    请将你的视频文件或任何你想用 ios 模拟器预加载的文件粘贴到下面的路径中

    String str = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS 9.2.simruntime/Contents/Resources/SampleContent/Media/DCIM/100APPLE/
    

    或者你可以使用下面的java代码将你想要的文件复制到模拟器位置。

      public  void preloadFiletoSimulator(String filename){
        try {
            File dest = new File(str);
            String name = AppConstant.RESOURCE_DIR+filename;
            File source = new File(name);
            FileUtils.copyFileToDirectory(source, dest);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    

    【讨论】:

      最近更新 更多