Post

Replies

Boosts

Views

Activity

Comment on 'File' couldn’t be moved because you don’t have permission to access 'Documents'
@Claude31 thank you for the quick reply! I've read through that post but to no avail. I've tried to recreate this in a dummy playground where I create a text file and move it to another both in the documents directory and that succeeded. I'm interacting with both the documents folder of the app and the documents folder of the 'Files' app on the phone - I think the latter is my problem. I'm using the following to get the sourceUrl. .fileImporter(isPresented: $isImporting, allowedContentTypes: [.zip], allowsMultipleSelection: false)
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
Comment on 'File' couldn’t be moved because you don’t have permission to access 'Documents'
@Claude31 thank you for the quick reply! I've read through that post but to no avail. I've tried to recreate this in a dummy playground where I create a text file and move it to another both in the documents directory and that succeeded. I'm interacting with both the documents folder of the app and the documents folder of the 'Files' app on the phone - I think the latter is my problem. I'm using the following to get the sourceUrl. .fileImporter(isPresented: $isImporting, allowedContentTypes: [.zip], allowsMultipleSelection: false)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on 'File' couldn’t be moved because you don’t have permission to access 'Documents'
@OOPer I have but similar to the user in that question I may have been doing it incorrectly. I will take another stab at using start/stopAccessingSecurityScopedResource again.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on 'File' couldn’t be moved because you don’t have permission to access 'Documents'
@OOPer retrying the startAccessingSecurityScopedResource now works. Code included as an answer for completion sake. I will accept @Claude31's answer as that captures the correct method. Thank you both again!
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21