How to create a list of directory and import images to them - iphone

As you knew, a iphone app has 4 directories: Application folder, Document, Library, tmp.
When app is installed in the first time, I want to:
Create a list of directories in Document folder
Import a list of images to each that directories.
I searched and found the way to create directory in Document folder by code.
[[NSFileManager defaultManager] createDirectoryAtPath:newDirectoryPath attributes: nil];
But following that way, user must create folder and import images by themself after installing app. I want my app do that.
Anybody know how to do it, please help me.
Thanks in advance!
Tien

I found out a solution for my situation. I mean that I want to create a list directory when app run at the first time. But now, I don't need to do it, I just need to add images to my resources folder and find the way to use them in interface builder.
Thanks you all for your attention and sorry for any inconvenient.
Regards,
Tien

Related

How to pass a files data from outside of application to a variable flutter

Thanks already. I stuck in this example for weeks.
in other examples mostly use apps own assets folder
I dont want to add file to asset folder.
I just want to get data from outside the app
and I want to assign this data to a variable
Filepicker package will solve the problem here is the link
You can access file name , path with this package

How to put files directly in the directory?

Is there a possibility to put a file (specifically a Json list) in the directory during the development of the application, other than through the user interface? I tried to put this file in the assets and then import it into a List in the code (the same list that is used for the directory), however when I deleted it, it would appear again. I wish someone could help me.I don't know if I could explain well...

Why copy a plist from the resources to document?

This is what is my understanding: the resources in the project folder are read only. So, almost all examples show copying a plist from the resources to the app's document folder. Why can we not simply find the app's document folder (after first run) and create the initial plist there (i.e. in the documents folder of the app so that subsequently we can modify the plist via code?
The answer is: Yes, you can create an initial plist there. But before you do this, consider using NSUserDefaults to save the settings.
Because there might already be data needed in a plist when the app is first installed; and that data has to come from somewhere. Why not from a plist?
I would also suggest using the Library folder rather than the Documents folder, just in case you do file sharing via iTunes at some stage. The Documents folder is available to the end user, whereas the Library folder is not.

How can I download an entire directory?

Is it possible in Objective-C to download an entire directory to the documents directory so I would end up with a subfolder in the documents directory with a name of my choosing? Then, is it possible to delete that directory and all its contents without looping through all the files? Many thanks in advance.
The short answer is 'Yes, its possible' given that the directory and files in question are not larger than the available space on the device. If you are talking about some text files or some images then I don't see a problem.
Not so sure about deleting all the contents without first getting a pointer to the files but that shouldn't take long in any case.
Were you looking for specific code examples as well?
There is a similar question, and answer [here].1
You cannot download entire folders over the internet, you would have to list the files and download them one by one.
You can use NSFileManager to create, read and remove files in your apps folder. You can delete a complete folder without having to loop through all the items in the folder.
(BOOL)removeItemAtPath:(NSString )path error:(NSError *)error;
Have a look at the NSFileManager documentation:
NSFileManager documentation
Keep in mind that whenever you go outside the "sandbox" of your app, your app will be rejected by apple. So keep those files within your app's bundle.

iPhone Simulating App Update at home before going out in the big bad world

this is a follow on from this question and the link given it seems that when an app is updated all of the files in the documents directory are copied into the updated apps documents directory and also anything in Library/Preferences. Whats the best way to simulate this for testing purposes?
Just copy the files in ApplicationSupport/iPhone Simulator etc? or has anyone developped any funky techniques for testing this.
I have created .sqlite file in my application's documents folder and created some dummy entries in my database table.
Now just change you code build new application without changing any of the certificate and profile information load the new application.
Now check for the old database table records. It will be definitely preserve under your Document directory in .sqlite file.
This is what i followed when i want to check it for same thing.
If anyone know better way then please feel free to suggest new things.
Jim.