Bug: potential problem with image/attachment deletion on iOS

Mike McEwan's Avatar

Mike McEwan

24 Sep, 2017 05:26 PM

Hi,

I’ve seen one or two other posts here that may relate to what I’m seeing, but no acknowledgement as to whether it is a bug or not. I would think it is, so here goes:

When adding images to my notes, and then deleting them, the amount of iCloud storage consumed by Bear will only go down if the deletion of the images/notes occurs on my Mac — i.e., deletions conducted from my iOS devices (iPad and iPhone) do not result in any reduction of iCloud storage usage.

My suspicion here is that images, and this is possibly true for attachments too, are not actually being deleted from the Local Files directory on my iOS devices, when I carry out a deletion there. Deletions from my Mac, however, do appear to be occurring . I’ve been able to verify things by looking at the following directory on my Mac, in addition to observing the iCloud storage usage details:

 ~/Library/Containers/net.shinyfrog.bear/Data/Documents/Application\ Data/Local\ Files

When adding images from my Mac, or my iOS devices, I can see the images appearing in the above directory on my Mac as Bear syncs my notes via iCloud. Upon deleting an image, or containing note, on my Mac, I can observe that the image file disappears after closing and restarting Bear on my Mac. I can also see that the iCloud storage utilisation by Bear goes down by roughly the size of the image files I have so deleted. When I carry out these deletions from my iOS devices, I do not see the image files disappear from the above directory (again, on my Mac), and Bear’s iCloud storage utilisation remains constant — i.e, it does not go down.

As noted in one of the afore-mentioned posts, I can reclaim my iCloud storage by backing up and restoring my entire Bear database as this has the effect of completely replacing the above directory. However, this is obviously not something I would want to do on a regular basis.

Could someone from Shiny Frog perhaps confirm that this is a bug, or point out any misunderstanding on my part?

  1. Support Staff 1 Posted by Danilo Bonardi on 28 Sep, 2017 08:26 AM

    Danilo Bonardi's Avatar

    Hi Mike,

    I think you are observing 2 different things both not bugs but I'll do more tests myself to be sure.

    The Bear delete the attachments only when it's closed for managing copy and undo/redo functionalities. In some very rare cases, you may be in a situation where you have copied a file or text containing a file string and a sync happen; In this case, you don't want to lose the real file on disc until you quit the app.

    The iCloud storage problem is more Apple concern than ours, but I suspect they keep copies of your files for a short(?) time for data recovery purposes. Make sure you are quitting the iOS app before verifying the iCloud space.

    Cheers.

  2. 2 Posted by Mike McEwan on 28 Sep, 2017 06:00 PM

    Mike McEwan's Avatar

    Danilo,

    Please report back here with the results of your personal tests. From my point of view, there is clearly something not quite right here and I’d be interested to hear if your results differ from mine.

    I’m not sure I’m completely understanding your english below, but I can confirm that when I conducted my tests, I was ensuring that I deleted the images in question from the trash to ensure they were completely expunged. I made sure that the images/notes were expunged across *all* my devices, and I did not copy any images between notes. I was also making sure that I completely shut down and restarted Bear on all devices before making my observations.

    As for the storage utilisation attributed to Bear that I could see under iCloud ‘Storage Management’, I don’t believe there is a problem with iCloud itself. As I state below: I can see pretty immediate reductions in iCloud storage utilisation when I conduct a deletion from my Mac (and restart Bear on my Mac). This would indicate to me that the iCloud ‘machinery’ is working as desired. I see no such reduction when I conduct a deletion from one of my iOS devices. Indeed, I can observe that my current Bear iCloud storage usage has *still* not reduced following the test deletions I made from my iOS devices, several days ago now.


    Mike.

  3. 3 Posted by Mike McEwan on 28 Sep, 2017 09:48 PM

    Mike McEwan's Avatar

    OK, I appear to be homing in a little further on this. What I think I’m seeing now is that image/attachment deletion does get triggered on iOS, but only when I force quit Bear in a certain way.

    I was in the process of turning on logging on my iPad, to see if I could provide a little more in the way of diagnostics, when I saw in the logs that I had somehow caused a whole slew of image files to get deleted. Some of these were, by now, several days old. In my earlier testing I had been force quitting Bear to ensure that It went through its cleanup operations. Or so I thought.

    I’m not entirely sure that I won’t come across as a little mad here, but there seems to be a subtle difference (on iOS 11 at least) between force quitting Bear by exiting the app, going to the multitasking screen and killing the app, and bringing up the multitasking screen directly from within the Bear app and killing it (i.e. not exiting Bear first). Only by using the second method can I get Bear to conduct image deletions.

    This seems a little odd, although I have been able to reproduce on both iPad and iPhone. Is there some application method that is perhaps getting called only under certain circumstances?

    In any case, I figure that I could have Bear running and.or suspended in the background for days or weeks at a time and wonder if having image attachment cleanup only trigger when the app completely terminates and restarts is the best way of doing things? Particularly when I have moved a note/image to the trash, and then deleted from there — this should be beyond the point of a potential undo operation and can surely be pushed out everywhere at that point?

  4. Support Staff 4 Posted by Danilo Bonardi on 02 Oct, 2017 12:34 PM

    Danilo Bonardi's Avatar

    Hi Mike,

    I debugged the iOS app and the application terminated callback (which is where the images are removed) is called in both the ways you close the app.

    The main problem is we are not in control of the undo/redo chain, MacOS/iOS are. I guess we can periodically check when an unneeded file disappears from the undo chain but will result in a memory heavy operation. BTW I think the solution we adopt is the one suggested by Apple.

    Cheers.

  5. 5 Posted by Mike McEwan on 02 Oct, 2017 06:04 PM

    Mike McEwan's Avatar

    Hi Danilo,

    Thanks again for the response.

    You don’t say whether you actually tried adding image/attachments of a known given size and observed files and iCloud storage utilisation in the same way I have? Anyhow, you mention an application termination callback — I wonder if, by this, you mean the Apple API applicationWillTerminate method on the app delegate object? If you do, it seems that this method is not necessarily called, even when a user force-quits an app.

    I’m not an iOS developer and so am not an expert here, but I do have experience of programming on other platforms and have perused the docs. You say ‘debugged’ and so I wonder if perhaps the very use of a debugger kept the app from suspending and hence you could not see what I believe I see. The Apple docs on applicationWillTerminate state:

    "For apps that support background execution, this method is generally not called when the user quits the app because the app simply moves to the background in that case. However, this method may be called in situations where the app is running in the background (not suspended) and the system needs to terminate it for some reason.”

    …and an App Life Cycle doc says:

    applicationWillTerminate: <https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623111-applicationwillterminate>—Lets you know that your app is being terminated. This method is not called if your app is suspended.

     <>
    Interpreting this then, I wonder if what I have seen is that when I kill an app by pressing the home button, and then go into the multitasking screen via a further double press of the home button, Bear has already gone into a ‘suspended’ state and therefore applicationWillTerminate does not get called? Conversely, when I go straight from a running Bear to the multitasking screen and kill it, Bear is still running in the background, and so applicationWillTerminate is called.

    It may, of course, be a simple matter of timing: If I quit Bear quickly, I catch it whilst it is still in the background, if slower, it will be suspended. In any case, as I mooted previously, I would not be ‘force quitting’ Bear at all under normal circumstances, and so it would appear that the cleanup of images/attachments would not normally happen.

    Again, I’m not the expert here, but wouldn’t the app delegate method applicationDidEnterBackground perhaps be a more appropriate place to carry out the ‘cleanup’ here?


    Mike.

  6. 6 Posted by Mike McEwan on 13 Oct, 2017 09:49 AM

    Mike McEwan's Avatar

    Hi,

    Just a polite bump, as it’s been over 10 days now, and there has been no response to my last update. I’m definitely still seeing this problem and am trying to decide if I should terminate my subscription (I’m coming to the end of my free first month for Bear Pro) at this point. I’ve liked most of what I’ve seen of Bear, but there appears to be a few things that, in my opinion, need addressing before I would perhaps re-subscribe. I would feel silly continuing on ,without any idea of if/when these might be looked at.

    At the very least it would be good to get some kind of acknowledgement that the issue I’ve raised in this thread exists. As I state in my last update: I have to force-quit Bear in a particular way to trigger the actual removal of deleted (and removed from trash) images and attachments. I would not normally do this (nor should I have to) under normal circumstances and so Bear’s iCloud storage utilisation will continue to grow, unnecessarily.

    — Mike.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac