Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageUploader 组件在ios上拍照上传图片后会刷新页面 #6026

Closed
breezefeng opened this issue Mar 9, 2023 · 5 comments
Closed
Labels

Comments

@breezefeng
Copy link

Version of antd-mobile

5.24.1

Operating system and its version

No response

Browser and its version

ios 12

Sandbox to reproduce

No response

What happened?

ImageUploader 组件在ios上拍照上传图片后会刷新页面,导致上传的图片数据丢失

Relevant log output

No response

@breezefeng breezefeng added the bug label Mar 9, 2023
@xiaoyao96
Copy link
Collaborator

这个应该是IOS系统层面的bug。在Safari、钉钉、QQ、微信等浏览器,通过h5 唤起相机后(不论是否拍照)返回,都高概率刷新网页,但从相册里选择照片不会刷新。

推测原因:IOS系统在打开相机时需要较高的运行内存,webview作为高内存占用的后台进程会被优先自动杀掉,来确保 相机 能正常运行。从相机返回时,检测webview已被杀死,所以触发了webview进程重启(刷新)。

这个问题暂无有效解决方案,如果用户遇到了,可以建议他使用相册再试。

@breezefeng
Copy link
Author

如果我不想给予选择相机的选项呢,需要怎么配置

@xiaoyao96
Copy link
Collaborator

如果我不想给予选择相机的选项呢,需要怎么配置

h5应该没有这个能力,目前我了解到的关于选择图片的方案有以下两种:

1、点击直接唤起拍照:

<input type="file" accept="image/*" capture="environment" /> 后置摄像头
<input type="file" accept="image/*" capture="user" /> 前置摄像头

2、点击出现 相册、拍照、文件 选择弹框

<input type="file" accept="image/*" /> 

目前这个刷新问题仅存在于IOS部分系统,如IOS16.2,概率较高的偶现。
但其他大部分手机是能正常使用拍照的,可以考虑给用户多个选择,如果无法正常拍照,可以引导他选择相册、文件等。选择方案2较合适。

@zhuchuanlei
Copy link

这就close了?是怎么解决的呀?

@funkyfun
Copy link

funkyfun commented Sep 6, 2024

小程序webview可以试试这个方案: 微信小程序webview组件拍照页面重载刷新bug解决方案 https://mp.weixin.qq.com/s/1QpyKLLuJMYcRd2t9fOgOA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants