Код: Выделить всё
private func generateTemporaryZipFile() -> URL? {
let fileManager = FileManager.default
let tempDirectory = fileManager.temporaryDirectory
let zipFileName = "my_data_backup.zip"
let zipFileUrl = tempDirectory.appendingPathComponent(zipFileName)
do {
let dummyContent = "This is some content for the ZIP file."
try dummyContent.write(to: zipFileUrl, atomically: true, encoding: .utf8)
return zipFileUrl
} catch {
print("Error creating dummy ZIP file")
return nil
}
}
Код: Выделить всё
if let url = generateTemporaryZipFile() {
ShareLink(item: url, preview: SharePreview("My ZIP File", image: Image(systemName: "doc.zipper"))) {
Label("Share ZIP", systemImage: "square.and.arrow.up")
}
}
< /code>
Это то, что распечатывает на консоли < /p>
Received port for identifier response: with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}
elapsedCPUTimeForFrontBoard couldn't generate a task port
Only support loading options for CKShare and SWY types.
error fetching item for URL:file:///private/var/mobile/Containers/Data/Application/E35A66B7-C065-492B-B402-AB66EB3D8FE2/tmp/my_data_backup.zip : (null)
error fetching file provider domain for URL:file:///private/var/mobile/Containers/Data/Application/E35A66B7-C065-492B-B402-AB66EB3D8FE2/tmp/my_data_backup.zip : (null)
error fetching item for URL:file:///private/var/mobile/Containers/Data/Application/E35A66B7-C065-492B-B402-AB66EB3D8FE2/tmp/my_data_backup.zip : (null)
Received port for identifier response: with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}
elapsedCPUTimeForFrontBoard couldn't generate a task port
< /code>
Такая же методика с фактическим Zip делает следующее < /p>
Received port for identifier response: with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}
elapsedCPUTimeForFrontBoard couldn't generate a task port
Received port for identifier response: with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}
elapsedCPUTimeForFrontBoard couldn't generate a task port
< /code>
Я не могу точно сказать, какие проблемы с правами у меня есть. Звучит возможно, мне нужно добавить право, но обмен ZIP на самом деле не вписывается в типы документов Подробнее здесь: https://stackoverflow.com/questions/797 ... h-error-is
Мобильная версия