NativeScript / NativeScript/plugins

[imagepicker] IOS - Uncaught Error: The file *** couldn't be opened.

Đang mở
#550 4 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
TypeScript
Star
206
Fork
123
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
1

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu tại @nativescript/imagepicker/index.ios.js, quanh _loop_2 ở dòng 142, và lần theo đường đi sau p.present() trong luồng pickImage được cung cấp. Tái hiện lỗi xảy ra khi chọn lần đầu trên các phiên bản iOS được liệt kê. Hoàn tất khi lỗi mở tệp không thường xuyên không còn làm ứng dụng kết thúc.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
ios, typescript
Lĩnh vực
mobile-dev
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.