2

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

Saeed Rahmatolahi
  • 1,317
  • 2
  • 27
  • 60

1 Answers1

3

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.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • There are countless examples. See http://stackoverflow.com/questions/1638834/how-to-check-if-a-file-exists-in-documents-folder for one of many. – rmaddy May 07 '17 at 04:51
  • I added their code to my app But It wasn't useful :( – Saeed Rahmatolahi May 07 '17 at 05:05
  • I need to have a mini file manager in my application that I can download and upload some files! with file sharing in iTunes i can reach downloaded files But I want user can copy files with iTunes to the application and then upload them with application - so user can copy files to the app with file sharing in iTunes Now! the problem is just that user can't see the files and upload them – Saeed Rahmatolahi Jul 04 '17 at 06:45