I want the user to select any file present in her/his iPhone so that it’s used as an e-mail attachment. For this purpose, I want to show the list of all files and folders present in iPhone. But how would I get the list of those files? Is there any way to get that list?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
Take into account that your app runs in a sandbox and would not be able to get any folder/file outside of that sandbox.
ObjectiveC
Swift 4
I'm an author of FileExplorer control which is a file browser for iOS and fulfills most of your requirements. Note that it allows you to browse only those files and directories that are placed inside your sandbox.
Here are some of the features of my control:
You can find my control here.
swift 3
Here's the slowest(?) approach:
but that should at least point you to a more specialized implementation for your needs.
Slightly lower level abstractions which allow you to enumerate on demand include
NSDirectoryEnumerator
andCFURLEnumerator
. Depending on the depth of the directory, these have the potential to save much unnecessary interactions with the filesystem, compared to-[NSFileManager subpathsAtPath:]
.You can use
NSDirectoryEnumerator
viaNSFileManager.enumeratorAtPath
From the docs: