Cannot find 'ArchiveByteStream' in scope

Viewed 382

I've been trying to understand AppleArchive Framework's uses and according to Apple's documented example, I've tried a Compression sample but I'm getting errors that 'ArchiveByteStream' and 'FilePermissions' cannot be found. Any help and tips would be nice, thanks.

https://developer.apple.com/documentation/accelerate/compressing_single_files?language=objc

guard let readFileStream = ArchiveByteStream.fileStream( path: file, mode: .readOnly, options: [ ], permissions: FilePermissions(rawValue: 0o644)) else { return }

1 Answers

Seems to be an Apple issue when targeting Simulator.

You can wrap this code with and if targetEnviornment clause:

#if !targetEnvironment(simulator)
guard let readFileStream = ArchiveByteStream.fileStream( path: file, mode: .readOnly, options: [ ], permissions: FilePermissions(rawValue: 0o644)) else { return }
#else
fatalError("Apple Archive isn't supported on simulator https://developer.apple.com/forums/thread/665465")
#endif
Related