Twitter | Search | |
Paul Haddad 22 Mar 19
How long do CKAssets actually stick around for, are we talking seconds/minutes or end of runLoop/operation?
Reply Retweet Like
Jacob Farkas
Do you mean the backing file on disk? The API only guarantees existence of that data until your callback block returns. Cleanup is done asynchronously but the API reserves the right to change that behavior. It’s best to move/copy that file somewhere else in the block.
Reply Retweet Like More
Paul Haddad 22 Mar 19
Replying to @farktronix
OK but which callback? For something like CKFetchRecordZoneChangesOperation recordChangedBlock, recordZoneChangeTokensUpdatedBlock or recordZoneFetchCompletionBlock?
Reply Retweet Like
Jacob Farkas 22 Mar 19
Replying to @tapbot_paul
In theory the guarantee only extends to the block the record is returned in. In practice it’s pretty unlikely that an asset for an outstanding operation would be cleaned up. I wouldn’t depend on it though- have the block hard link the file (handle errors on macOS and copy).
Reply Retweet Like