至少在我的 iPhone 6 Plus 上,当我使用<input type="file">
让用户上传图像。
<div class="add__from-camera">
<button class="add__from-camera__btn">
<i class="fa fa-fw fa-camera"></i> Add with Camera
</button>
<input class="add__from-camera__input" type="file">
</div>
这种其余情况会导致选项卡崩溃大约 50% 的时间,而在我的应用程序中大约 90% 的时间崩溃。
我很“幸运”,当错误发生时,所有 Safari 都崩溃了,这是日志的一部分:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00030000006467ba
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 WebKit 0x000000018a48566c WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon(WTF::Vector<WTF::String, 0ul, WTF::CrashOnOverflow> const&, WTF::String const&, API::Data const*) + 44
1 WebKit 0x000000018a461648 WebKit::WebOpenPanelResultListenerProxy::chooseFiles(API::Array*, API::String*, API::Data const*) + 100
2 WebKit 0x000000018a461648 WebKit::WebOpenPanelResultListenerProxy::chooseFiles(API::Array*, API::String*, API::Data const*) + 100
3 WebKit 0x000000018a413020 -[WKFileUploadPanel _chooseFiles:displayString:iconImage:] + 468
它似乎表明显示小缩略图预览时出现(溢出?)错误?有没有办法防止 Safari 在使用文件输入时崩溃,或者至少不渲染缩略图预览?
尝试这个:
<input class="add__from-camera__input" type="file" accept="image/*;capture=camera">
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)