apache / apache/cordova-plugin-file

fileEntry.file caused app crash on iOS simulator

Open
#505 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
744
Forks
754
Avg merge
3d 4h
Merged PRs (30d)
1

Description

# Bug Report

## Problem
I record audio with Cordova-plugin-media and try to save it with Cordova-plugin-file. On real device (from TestFlight) it works correctly, but I need to run it on simulator. When I run my code on simulator, app crashes without any readable reason
### What is expected to happen?
fileEntry.file works correctly on simulator and returns File object, like it does on real iPhone

### What does actually happen?
simulator crashes, I can't debug my code

### Command or Code
```
// stop recording and save file
mediaRec.stopRecord()
mediaRec.release()

window.requestFileSystem(window.LocalFileSystem.TEMPORARY, 0, (fileSystem) => {
fileSystem.root.getFile(src, {}, (fileEntry) => {
// next string causes crash
fileEntry.file((file) => {
changeHandler(file)
})
})

```
### Environment, Platform, Device
iOS, MacBook Air 2020, Simulator iPhone SE 2020 (iOS 15)

### Version information
Cordova: 10.0.0
Cordova-plugin-file: 6.0.2

## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided fileEntry.file call in the iPhone SE 2020 simulator with Cordova-plugin-file 6.0.2 and Cordova 10.0.0, then trace the plugin's iOS implementation. Done means the call returns a File object without crashing on the iOS 15 simulator while continuing to work on a real iPhone.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.