I would like to save the images in the domain of iPhone users, so I will write the following code.
let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)[0] print(path)
It shows how: /Users/xxx/Library/Developer/CoreSimulator/Devices/1312F880-6BDC-45D2-B3B3-4D2374313C67/data/Containers/Data/Application/A2850237-5E71-4373-81A6-B443032E1951/Documents/
In this case, application identifier A2850237-5E71-4373-81A6-B443032E1951
And the problem is that when I run the simulator WITHOUT REMOVING APP again, it shows: /Users/xxx/Library/Developer/CoreSimulator/Devices/1312F880-6BDC-45D2-B3B3-4D2374313C67/data/Containers/Data/Application/1F9B5B0A-5A6C-4098-BF40-C978C60C93AF/Documents/
In this case, the application identifier is 1F9B5B0A-5A6C-4098-BF40-C978C60C93AF
Thus, there is a difference in the application ID between the previous and current installation, although I just updated the application and did not delete the application. Why is this caused and how to fix it?
It calls Xcode 7.2, 7.1, 7.0. And this is due not only to the installation of the simulator, but also to the actual installation of the device. Therefore, if iOS users update the application from the application store, the Application ID will be changed and the application sandbox will also be changed, and finally, users will not be able to link to their images.
Similar situations:
Relevant recommendations:
Thanks in advance.
EDIT
It seems that I need to continue the path as relative, not absolute.
I will try the approach, and if I solve my problem, I will update the question.