NativeScript / NativeScript/plugins
[imagepicker] IOS - Uncaught Error: The file *** couldn't be opened.
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 206
- フォーク
- 123
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 1
説明
Issue: Every once in a while the following error occurs when selecting an image with the image picker.
This mostly happens "the first time" a picure is selected after opening the app. Following the exact same steps most times the imagepicker works as expected without throwing the error. It only occurs sometimes without any changes to the code, process, etc. Sentry tells it happens more often. The issue happens on IOs 16.4, and 17.1, and probally other versions.
Log:
on device 9B1D4E42-9CE9-452E-B84F-EE40C6D438F4.
Error while parsing debug response object. Error: BINDINGS: string value expected
authorizing...
***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught Error: The file ‚ *** couldnt' be opened.
at
_loop_2(file: src/webpack:/groeigids/node_modules/@nativescript/imagepicker/index.ios.js:142:0)
at (file: src/webpack:/groeigids/node_modules/@nativescript/imagepicker/index.ios.js:152:0)
at timer(file: src/webpack:/groeigids/node_modules/zone.js/fesm2015/zone.js:2561:0)
at invokeTask(file: src/webpack:/groeigids/node_modules/zone.js/fesm2015/zone.js:406:0)
at runTask(file: src/webpack:/groeigids/node_modules/zone.js/fesm2015/zone.js:178:0)
at invokeTask(file: src/webpack:/groeigids/node_modules/zone.js/fesm2015/zone.js:487:0)
at ZoneTask.invoke(file: src/webpack:/groeigids/node_modules/zone.js/fesm2015/zone.js:476:0)
at data.args.(file: src/webpack:/groeigids/node_modules/zone.js/fesm2015/zone.js:2541:0)
at invoke(file: src/webpack:/groeigids/node_modules/@nativescript/core/timer/index.ios.js:54:0)
at invoke(file: src/webpack:/groeigids/node_modules/zone.js/fesm2015/zone.js:372:0)
at runGuarded(file: src/webpack:/groeigids/node_modules/zone.js/fesm2015/zone.js:144:0)
at (file: src/webpack:/groeigids/node_modules/zone.js/fesm2015/zone.js:128:0)
at TimerTargetImpl.tick(file: src/webpack:/groeigids/node_modules/@nativescript/core/timer/index.ios.js:18:0)
Code and setup:
public pickImage(options?: OptionsCommon, hostView?: View): Promise {
// Create image picker
const p = imagePicker.create({
mode: 'single',
maximumNumberOfSelection: 1,
mediaType: ImagePickerMediaType.Image,
}, hostView); // Hostview is important to render on top of a modal
// Authorization is required (allow app to ...)
return p.authorize()
.then(() => p.present()) // Present the imagepicker
.then((selection) => {
const imagePickerSelection = selection[0];
return Promise.all([Promise.resolve(imagePickerSelection.asset), isIOS ?
ImageSource.fromAsset(imagePickerSelection.asset) : null]);
})
.then((f: [ImageAsset, ImageSource]) => this.processPickedImage(f, options))
.catch(reason => Promise.reject(this.processPickingFailure(reason)));
}
The key NSPhotoLibraryUsageDescription has been added to info.plist
The error occurs after the p.present() and picking the image.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
@nativescript/imagepicker/index.ios.js の142行目付近にある _loop_2 から開始し、提供されている pickImage フローで p.present() の後の経路を追跡してください。記載されている iOS バージョンで、最初の選択時の失敗を再現してください。断続的なファイルオープンエラーによってアプリが終了しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ios, typescript
- 領域
- mobile-dev
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100