The application folder name changes every time I run the simulator

When I restart the application, the folder name in finder changes from

09323D3F-D371-4556-ABA3-BD23AF487F12

to

E771BBEC-ACC6-489C-B7C1-B5FF11004CB2 /

NSHomeDirectory() changes every time I run the application in the simulator.

+1
source share
3 answers

Do not save the full path, but only the directory and file name for the images. Since this behavior is new in iOS 8, it can also happen on a real device.

+8
source

I think you have this link in NSDocumentationDirectory code to change it to NSDocumentDirectory

 NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
0
source

save the file path as follows:

 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:[[yourArray objectAtIndex:indexPath.section]lastPathComponent]]; 
0
source

Source: https://habr.com/ru/post/1241237/


All Articles