上传图片时iOS应用程序WKWebView错误

标签 ios swift iphone wkwebview entitlements

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/

相关文章:

ios - 在 swift 中将边框宽度和颜色分配给 textview 时应用程序崩溃

swift - fatal error : unexpectedly found nil

objective-c - 在 Objective-C (iPhone) 中将字符串保存到文件中

iPhone 配置文件问题

ios - 如何在 iOS 6 中将 Tab Bar 的背景颜色更改为半透明

objective-c - NSTimer 可能的崩溃原因

html - Google Web 字体在 iOS7 中的 Tumblr 页面上不起作用

ios - swift中如何基于协议(protocol)实现路由

android - react 原生 : How to open OS settings in Android and iOS?

ios - 下载时如何在 UIImageView 中显示渐进式 JPEG?