Skip to content

Crash when enabling iCloud sync in non-entitled builds #321

@tymrtn

Description

@tymrtn

Summary

Enabling iCloud sync can crash Flycut in builds that do not have valid iCloud entitlements (for example local unsigned builds used for debugging).

Affected area

  • iCloud sync startup path (MJCloudKitUserDefaultsSync)

Steps to reproduce

  1. Launch Flycut in a build without iCloud entitlements.
  2. Enable iCloud Clippings Sync in Preferences.
  3. Save/close preferences.

Alternative repro via defaults:

defaults write com.generalarcade.flycut syncClippingsViaICloud -bool true
defaults write com.generalarcade.flycut savePreference -int 2

Then launch Flycut.

Actual behavior

Flycut terminates due to CloudKit startup path reaching invalid container/entitlement state.
Observed crash signatures include:

  • CKException: containerIdentifier can not be nil
  • CloudKit _os_crash (EXC_BREAKPOINT/SIGTRAP) in enable path

Expected behavior

If iCloud container configuration/entitlements are unavailable, Flycut should not crash. It should safely skip CloudKit enablement.

Proposed fix

Add defensive guards in MJCloudKitUserDefaultsSync:

  • Verify effective container identifier before enabling.
  • Verify process has iCloud container entitlement before CloudKit calls.
  • Wrap container creation in exception-safe checks and bail out cleanly.

Notes

This does not change normal signed/entitled behavior. It only prevents hard crashes when the environment cannot support CloudKit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions