Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

On first app run, cache.db is backed up to iCloud #5577

Closed

Description

@dapetcu21

I found the following bug:

When you first open the app, there is no cache.db to begin with. setResourceValue:forKey:NSURLIsExcludedFromBackupKey is getting called on the file, but you have no guarrantees that the file is created at that point and the call won't fail silently.

So, on the first run, NSURLIsExcludedFromBackupKey might be set before cache.db is created, hence being left with cache.db being backed up by iCloud, automatically rejecting your app when reviewed on the App Store.

A simple and effective solution (that I employed in my app) is to set NSURLIsExcludedFromBackupKey on the cache directory, which is ensured to exist, instead of on the file.

I'll submit a PR in a sec.

Platform: iOS
Mapbox SDK version: 3.2.0

Steps to trigger behavior

  1. Use offline maps in your app
  2. Download a big enough offline pack in the first run of the app
  3. Publish the app to the App Store

Expected behavior

Though big in size, cache.db will be marked with NSURLIsExcludedFromBackupKey, so it will not be backed up. Hence, your app will pass the review process with flying colors.

Actual behavior

Your app will get rejected because cache.db is not properly excluded and you'd end up saving hundreds of MB on the user's iCloud account.

Activity

  1. dapetcu21 commented on Jul 5, 2016

    @dapetcu21
    Author

    If you want to try to reproduce, I suggest using

    xattr -l ~/Library/Developer/CoreSimulator/Devices/${DEVICE_UUID}/data/Containers/Data/Application/${APP_UUID}/Library/Application\ Support/${APP_BUNDLE_ID}/cache.db

    to test if the com.apple.metadata:com_apple_backup_excludeItem extended attribute is there.

  2. friedbunny commented on Jul 6, 2016

    @friedbunny
    Contributor

    Thanks again for reporting this and proposing #5578, @dapetcu21.

  3. added
    iOS
    on Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugiOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions