Web Filter causing App to hang

I have been developing this one App for far too long (3 years). Part of it's functionality is to store away game files and statistics so that they can be shared by multiple devices. Originally I had used GameKit for this as it seemed the most accessable way to do it; But, as I was about done with the App I realized that this was probably a bad idea. I then spent a year converting over to using UIDocuments in an App Container on the iCloud. Along the way I have experienced an occasional glitch where files/modification date, etc. get lost. So, I have put a lot of work into bullet proofing my interactions with iCloud but on Jan 2, 2018 I started getting this message randomly in several runs of my App.


     yyyy-MM-dd HH:mm:sss SudokuAandT[***:XXXXXX] WF: === Starting WebFilter logging for process SudokuAandT

     yyyy-MM-dd HH:mm:sss SudokuAandT[***:XXXXXX] WF: _WebFilterIsActive returning: NO


Understand, I am not doing any web based code in my App except doing a NSMetadataQuery to get the UIDocuments. After a hour or so this stopped happening and I haven't seen it since. If I had to guess I would say that AdMob is sending non-SSL compliant URLs and something from Apple is generating the messages.


The problem this caused was that files would start to open but never return from the call. This caused my Statistics file to think it was on an empty cloud container and regenerated a clean file. I was expecting that after the cloud came back I would get a Conflict, which I have code to restore from conflict. But, instead the newly generated Statistics file was accepted as a modification of the old and thus I lost all the data. I have modified the code to not let this happen again, the same way.


I tried to use the iCloud Drive file recovery system to request a recovery of the file but it seems that it does not access files that are in an iCloud Container for a specific App. Is there a way to request this file to be restored? I need to prove I can do this so in case it happens to my users I can request it for them.


Jan 5, 2017


The problem came back today. After the app had been sitting there running, doing nothing but displaying ads for 573 seconds I got the message again.


M 79.156S: adViewDidReceiveAd

M 149.733S: adViewDidReceiveAd

M 220.427S: adViewDidReceiveAd

M 291.801S: adViewDidReceiveAd

M 361.991S: adViewDidReceiveAd

M 432.524S: adViewDidReceiveAd

M 504.650S: adViewDidReceiveAd

M 573.531S: adViewDidReceiveAd

2018-01-05 11:15:40.383236-0600 SudokuAandT[2671:535961] WF: === Starting WebFilter logging for process SudokuAandT

2018-01-05 11:15:40.383508-0600 SudokuAandT[2671:535961] WF: _WebFilterIsActive returning: NO

M 644.361S: adViewDidReceiveAd

M 714.905S: adViewDidReceiveAd

M 785.571S: adViewDidReceiveAd

M 856.267S: adViewDidReceiveAd

M 927.132S: adViewDidReceiveAd

M 998.092S: adViewDidReceiveAd


After stopping and starting, the App continued to work OK, loading the Statistics and game files and displaying correctly. So, I continued debugging for 45 minutes and had made another file and it got saved to the cloud. I have some code that is deferred execution until after the App is up and running for the user. This code recognized the new file as not having been logged into my data base and tried to delete it. At this point the App hangs and reports the following:


M 15.816S: Consistency Error, Missing gameCreated, 00FZZVMQ.lmlsat

O 15.829S: init(fileURL:) called for 00FZZVMQ.lmlsat count = 3

O 19.775S: will open(completionHandler:) 00FZZVMQ.lmlsat, documentState = Normal, Closed, 1

2018-01-05 11:51:27.190606-0600 SudokuAandT[2708:544923] void SendDelegateMessage(NSInvocation *): delegate (webView:resource:didFinishLoadingFromDataSource:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

2018-01-05 11:51:37.193180-0600 SudokuAandT[2708:544923] void SendDelegateMessage(NSInvocation *): delegate (webView:resource:didFinishLoadingFromDataSource:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

2018-01-05 11:51:47.194566-0600 SudokuAandT[2708:544923] void SendDelegateMessage(NSInvocation *): delegate (webView:resource:didFinishLoadingFromDataSource:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

continues forever ...


I am not sure why every other file loads but this one, either something with the file, which I can't see because it loaded earlier, or it is because it is after the App has finished loading.


And after a couple of hours it is working again.


So, I guess my question has changed from how to restore the Container File to how do I handle this problem so my App does not hang?

Replies

Is your question really about CloudKit? I have never heard of a class called NSMetadataQuery involving CloudKit.

No it is not using CloudKit, in my Capabilities tab I have checked the Services, Key-Value storage and iCloud Documents. Not CloudKit. NSMetaDataQuery is documented in the manual on using iCloud for UIDocuments.

This make me think that I have seen the files listed in some window before, I just can't remember where, in XCode, in iCloud Dashboard, etc. I will look for it some more. If you can give me an idea where to look that would be great.