在 WKWebView
中,当我通过 Ajax 使用 FormData 将图像上传到我们的服务器时收到此警告。整个过程成功完成。
任何人都可以建议缺少的权利是什么。我已查看与 WKWebView
在控制台中,我看到 pid 与“webkit.uploads”相关联
“缺少必需的客户端授权” 请求原因:FinishTaskUnbounded;原因:FinishTaskUnbounded;标志:PreventTaskSuspend>
// xcode debug console on submit
MyDomain[3002:428982] [ProcessSuspension] 0x104be68a0 - ProcessAssertion() PID 3002 Unable to acquire assertion for process with PID 3002
MyDomain[3002:427999] [ProcessSuspension] 0x104be68a0 - ProcessAssertion::processAssertionWasInvalidated()
MyDomain[3002:428982] [assertion] Error acquiring assertion: <NSError: 0x281b3b6f0; domain: RBSAssertionErrorDomain; code: 2; reason: "Required client entitlement is missing"> {
userInfo = {
RBSAssertionAttribute = <RBSLegacyAttribute: 0x100f2ee40; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
}
}
// javascript upload code
var formData=new FormData();
formData.append("action", 'save');
var fileInput = document.getElementById('addImage');
if (fileInput.files && fileInput.files[0]) {
var file = fileInput.files[0
formData.append('messageImage', file);
hasFile = true;
}
if(hasFile){
$.ajax({
type: "POST",
url: "/images/save",
data: formData,
dataType: 'json',
contentType: false,
processData: false,
success: function(result){}
});
}
最佳答案
我对 wkWebView 的这个错误和其他错误有一种预感,我想我证明了这一点。它与文件上传时间过长有关,iOS 提示它,wkWebView 被“释放”(根据另一个线程)。就我而言,我的上传时间在 5 到 13 秒之间。
我在 Web Worker 中实现了我的上传,结果证明这在 Cordova 上有点棘手,但一旦我这样做,所有问题都消失了。
关于上传图片时iOS应用程序WKWebView错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58242437/