Posts

Post not yet marked as solved
6 Replies
6.3k Views
I'm struggling to figure out how to rename an instance of a UIDocument subclass in an iCloud folder. I've tried saving the document with the new URL…func renameDocument(to name: String) { let targetURL = document.fileURL.deletingLastPathComponent().appendingPathComponent(name) .appendingPathExtension("<extension>") document.save(to: targetURL, for: .forCreating) { success in guard success else { // This always fails return } // Success } }…but this fails with…Error Domain=NSCocoaErrorDomain Code=513 "“<new-file-name>” couldn’t be moved because you don’t have permission to access “<folder>”." UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Containers/Data/Application/1A9ACC2B-81EF-4EC9-940E-1C129BDB1914/tmp/(A Document Being Saved By My App)/<new-file-name>, NSUserStringVariant=( Move ), NSDestinationFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/<folder>/<new-file-name>, NSFilePath=/private/var/mobile/Containers/Data/Application/1A9ACC2B-81EF-4EC9-940E-1C129BDB1914/tmp/(A Document Being Saved By My App)/<new-file-name>, NSUnderlyingError=0x1c4e54280 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}…and just a simple move…func renameDocument(to name: String) { let targetURL = document.fileURL.deletingLastPathComponent().appendingPathComponent(name) .appendingPathExtension("<extension>") do { try FileManager.default.moveItem(at: document.fileURL, to: targetURL) } catch { // This always fails } // Success }…which fails with…Error Domain=NSCocoaErrorDomain Code=513 "“<old-file-name>” couldn’t be moved because you don’t have permission to access “<folder>”." UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/<folder>/<old-file-name>, NSUserStringVariant=( Move ), NSDestinationFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/<folder>/<new-file-name>, NSFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/<folder>/<old-file-name>, NSUnderlyingError=0x1c4c4d8c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}Both of these work fine for local files, and renaming iCloud files works OK in the UIDocumentBrowserViewController root view controller. My guess is that there's some permission missing somewhere that allows the app to write to iCloud folders.For info, the info.plist contains all the following keys…LSSupportsOpeningDocumentsInPlaceNSExtensionFileProviderSupportsEnumerationUISupportsDocumentBrowser
Posted
by ash69.
Last updated
.
Post marked as solved
5 Replies
1.1k Views
This is a copy of my post from StackOverflow to find a wider audience I've received the following rejection of a SwiftUI MacOS app: "We discovered one or more bugs in your app when reviewed on Mac running macOS 13.2.1. We received the attached error message at launch." The full message is: The open file operation failed to connect to the open and save panel service. with the attached screenshot: I've never seen this message before, and I've no idea how to reproduce it. Per Technical Q&A QA1778, How to reproduce bugs reported against Mac App Store submissions, I've exported the archived app and run on a guest account on macOS 13.2.1, but it runs and can open files as expected. I've tried opening a file on an external drive, and on iCloud Drive (successfully). If it helps, it's a SwiftUI DocumentGroup viewing app. Has anybody seen this message before, or has any idea how I could reproduce it?
Posted
by ash69.
Last updated
.
Post not yet marked as solved
1 Replies
1k Views
I have single view controller with a UIButton containing the following code:import UIKit class ViewController: UIViewController { required init?(coder: NSCoder) { super.init(coder: coder) } @IBSegueAction func makeAnotherController(coder: NSCoder, sender: Any?, segueIdentifier: String?) -> ViewController? { return ViewController(coder: coder) } }According to the release notes, this is the correct signature for a @IBSegueAction, and it compiles OK. The release notes say…Create a connection from a segue to an @IBSegueAction method on its source view controller. On new OS versions that support Segue Actions, that method will be called … An IBSegueAction method takes up to three parameters: a coder, the sender, and the segue’s identifier. The first parameter is required, and the other parameters can be omitted from your method’s signature if desiredI'm unable to complete the first step (create a connection)by dragging from the storyboard scene to the assistant editor, although I can connect to other outlets or actions without issueAny thoughts? Xcode 11 bug or am I doing something wrong?
Posted
by ash69.
Last updated
.