how to Display Files From Files Sharing in Swift 3

荒凉一梦 提交于 2019-12-13 15:47:51

问题


A added File Sharing in Plist in My app So I can Easily Copy Files when The iPhone has connect with iTunes to my mac But the problem is that when I copy some files with iTunes in my App and Run the app I have 2 Problems :

1- when I stop the app and open that again I can't see any files in iTunes in the file sharing part

2- This code Below here should print file Exists if there is file and print some thing else if there isn't file But Just Print File Exists

here is my codes

if filemgr.fileExists(atPath: "/Applications") {
            print("File exists")
        } else {
            print("File not found")
        }

when I click the button to check files I just See File Exists even when I delete the app and install it again please help me


回答1:


When you enable file sharing for an iOS app, it allows your users to copy, delete, and rename files that to, from, and in your app's Documents folder.

Your code needs to first get a reference to its own Documents folder (which can change each time your app runs).

Then it can use the various methods of FileManager to get a list of files from that folder.



来源:https://stackoverflow.com/questions/43820961/how-to-display-files-from-files-sharing-in-swift-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!