AppleArchive crashes on corrupt archive instead of failing gracefully

We're trying to implement a backup/restore data feature in our business productivity iPad app using UIDocumentPickerViewController and AppleArchive, but discovered AppleArchive crashes instead of failing gracefully when decrypting a corrupt archive.

As described in forum post 765101, UIDocumentPickerViewController can handoff a corrupt copy of an archive to UIDocumentPickerDelegate under specific circumstances.

We've duplicated this behavior with iPadOS 16.6.1 and 17.7 when building our app with Xcode 15.4 targeting minimum deployment of iPadOS 16. We haven't tested this with the bleeding edge iPadOS 18.

Our app is primarily Objective-C, but it utilizes the Swift-based AppleArchive 'EncryptingAndDecryptingDirectories' sample code associated with WWDC21 session: 10233: Bring Encrypted Archives and Performance Improvements to Your App with Accelerate.

The WWDC21 'EncryptingAndDecryptingDirectories' Swift sample project crashes in a similar manner when a corrupt archive file created by UIDocumentPickerViewController is dropped into the sample app's window for decryption (see attached crash log).

Does anyone know if there's a workaround for the 'EncryptingAndDecryptingDirectories' sample project to prevent AppleArchive from crashing when decrypting a corrupt archive?

Hi,

We have addressed some issues around broken streams in macOS Sequoia, iOS 18, and iPadOS 18. Please could you try those and if the issue still persists, raise a report via Feedback Assistant.

Unfortunately, we're not set up to test the bleeding edge iOS 18. In the past we've been burnt by bugs in the initial releases of iOS, which prevented us from updating our apps for our customers using older versions of iOS. Our customers place a premium on dependable, reliable productivity software so they're unlikely to upgrade to iOS 18 until it's proven to be stable. Unlike Apple, we're a small company with limited resources. We'll gladly test iOS 18 for this bug if Apple sends us a complementary Mac and iPad so we can install Apple's bleeding edge tools without affecting our existing work computers.

We ran our test code on iPadOS 18.2 when building with Xcode 16.2. We are happy to report the AppleArchive code now fails gracefully in lieu of crashing.

Similarly, the WWDC21 'EncryptingAndDecryptingDirectories' Swift sample project now fails gracefully in lieu of crashing when executed on macOS Sequoia 15.2 when built with Xcode 16.2.

In other words, the refactored streaming code is performing correctly (as best we can tell).

We'd like to know if we need to limit our app's backup/restore data feature to iPadOS 18 and later.

Does Apple have plans to fix the AppleArchive crash in iPadOS 16 or 17?

AppleArchive crashes on corrupt archive instead of failing gracefully
 
 
Q