名为com.apple.nsurlstorage-cache的服务的连接已失效 [英] The connection to service named com.apple.nsurlstorage-cache was invalidated

查看:385
本文介绍了名为com.apple.nsurlstorage-cache的服务的连接已失效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为iOS8创建一个自定义键盘,我很难解决NSURLConnection的一些问题。

I'm creating a custom keyboard for iOS8, and I'm having a tough time figuring out some issues with NSURLConnection.

我使用sendAsynchronousRequest:方法如下:

I'm using the sendAsynchronousRequest: method like this:

[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        NSLog(@"recieved asynchronous response");

        if (!connectionError) {
            [self connection:nil didReceiveData:data];
            [self connectionDidFinishLoading:nil];
        }
        else{
            NSLog(@"connection failed - %@", connectionError);
        }
    }];

这一切看起来都能正常工作一段时间正确接收数据。此后,我开始看到以下错误消息:

This all seems to work correctly for a period of time (1-2 days), and I can correctly receive data. After this time I start seeing the following error message:

 ***cachedResponseForRequest:key:handler failed: 

错误Domain = NSCocoaErrorDomain Code = 4099无法完成操作(Cocoa错误4099)
(与名为com.apple.nsurlstorage-cache的服务的连接失效。)UserInfo = 0x17579030
{NSDebugDescription =与名为com.apple.nsurlstorage-cache的服务的连接失效。 {
NSDebugDescription =与名为com.apple.nsurlstorage-cache的服务的连接已失效。;

Error Domain=NSCocoaErrorDomain Code=4099 "The operation couldn’t be completed. (Cocoa error 4099.)" (The connection to service named com.apple.nsurlstorage-cache was invalidated.) UserInfo=0x17579030 {NSDebugDescription=The connection to service named com.apple.nsurlstorage-cache was invalidated.}; { NSDebugDescription = "The connection to service named com.apple.nsurlstorage-cache was invalidated.";

我只能这样使事情再次正常工作是重置内容和在手机上的设置。如果任何人可以指出我正确的方向,为什么这种情况发生,我会非常感谢。提前感谢。

The only way I then seem to be able to make things work correctly again is to reset the content and setting on the phone. If anyone could point me in the correct direction as to why this is happening I would be very grateful. Thanks in advance.

推荐答案

这发生的原因是设备不允许您的键盘使用互联网。

This occures because the device didn't allow your keyboard to use internet.

要解决这个问题,首先检查您的键盘扩展的Info.plist对于RequestsOpenAccess键是否为YES。

To fix this, first check that your keyboard extention's Info.plist has the value "YES" for the key "RequestsOpenAccess".

然后,在设备上安装应用程序后,转到设置 - >常规 - >键盘 - >键盘 - >,然后打开允许完全访问按钮。

Then, after installing your app on a device, go to Settings -> General -> Keyboard -> Keyboards -> , and turn on the "Allow Full Access" button.

这篇关于名为com.apple.nsurlstorage-cache的服务的连接已失效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆