Situation : I have an iOS application that deals with files and allows the user to save, edit, open and perform various operations with these files. I would like to have some ready-made documents for the user to see when they open the application (for example, a template) along with their own documents.
Problem : How to create a document (or template file) and display it in the Documents folder after the user installs my application and launches it (and all the previous ones)?
Background : This document (the one to be installed in the application’s document directory) is created by me, not by the user.
I know that for this you need to save it in your package, and then, when your application is launched for the first time, quietly copy it to the document directory. Do I have to copy it in the appDidFinishLaunchingWithOptions method or in the viewDidLoad method and write the logic to determine if this was the first time I started the application?
My code : On this web page: http://textsnip.com/d35fbc
But when it starts, it always says: “The file does not exist [in the folder with documents]”, then it tells me that it is being copied. The problem is that when I look at the application's document folder, it never exists, it is still in the package.
Why doesn't he copy this code How does it work?
source
share