Apple Archive: Cannot find 'ArchiveByteStream' in scope

I need to implement ZIP file and directory compression without using any third party libraries and Apple Archive looks like it would do the trick. Unfortunately, whenever I try to make use of it (yes, I did import it), I get out of scope errors.

The Swift import headers are all essentially empty in the Xcode 12.2 beta. The Objective C headers exist, though.

Before I put any more time into this, does anyone know if/when Apple Archive will be implemented as documented? Has it been pulled from the SDK but the documentation not updated? I'm a little worried about trying to use the Objective C variant because I cannot find anything on the status of the framework in general.

Thanks,

Kevin
Answered by DTS Engineer in 644012022
What platform are you targeting?

With Xcode 12.1 (haven’t yet installed 12.1.1, and I don’t have time to test on Xcode 12.2 beta) my Apple Archive code, like that in this article, only compiles if I target an iOS device. The same code won’t build for the simulator, with symptoms very much like what you’ve described.

I need to implement ZIP file

Be aware that Apple Archive uses a custom archive format; it does not support zip archives.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer
What platform are you targeting?

With Xcode 12.1 (haven’t yet installed 12.1.1, and I don’t have time to test on Xcode 12.2 beta) my Apple Archive code, like that in this article, only compiles if I target an iOS device. The same code won’t build for the simulator, with symptoms very much like what you’ve described.

I need to implement ZIP file

Be aware that Apple Archive uses a custom archive format; it does not support zip archives.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"

With Xcode 12.1 (haven’t yet installed 12.1.1, and I don’t have time to test on Xcode 12.2 beta) my Apple Archive code, like that in this article, only compiles if I target an iOS device. The same code won’t build for the simulator, with symptoms very much like what you’ve described.

That was the problem. It works on device, but results in build errors when trying to target the similar. Hope this is fixed soon. Thank you for your help!




Hope this is fixed soon.

I encourage you file your own bug about this. Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com" 70064512
Feedback FB8880428 filed for this bug.
Same here - still an issue with Xcode 12.3... 😕

Luckily we already had a fallback to Zip for pre-iOS 14 devices, which we're now also using when building against the simulator (using #if targetEnvironment(simulator)).

Filed as FB8964166.
Same issue facing here.
I am get compile time error: even running. in real device
  1. Cannot find FilePath.

  2. Cannot find ArchiveByteStream.

  3. Cannot find FilePermissions.

Xcode version: 12.4
Device Version: 14.4.2


I have worked on it before some months so that time I was able to import AppleArchive Framework. But now there is no suggestion for importing it. Now I think this Framework has been removed from Apple.


Now I think this Framework has been removed from Apple.

That’s definitely not the case.

I just retested this (per my earlier post) with Xcode 12.5 and saw the same results: My Apple Archive code builds when compiling for the device and fails when compiling for the simulator. If you’re seeing anything different it’s likely to be something specific to your project or your environment. My advice is that you rule out the former by retesting in a tiny test project created from one of Xcode’s built-in templates. Let us know what you see.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I am getting the same problem with building for device Xcode 12.5 with the import ArchiveByteStream no such module and errors around FilePath, FilePermissions Cannot find type in Scope.

fixed by adding import System and @available(iOS 14.0, *) for the function enclosing the archiving code

As this just came up in a different thread, I thought I’d check on the state of this bug (FB8964166). I’m sad to report that this is not fixed in Xcode 13 )-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It seems that Xcode 14 contains a fix for this bug (FB8964166) but things are still not quite working right in the simulator. See this thread for the details.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Apple Archive: Cannot find 'ArchiveByteStream' in scope
 
 
Q