Application folder name changes every time i run in simulator [duplicate]

隐身守侯 提交于 2019-12-24 03:40:53

问题


Whenever I restart my application it's folder name in finder is changed from

09323D3F-D371-4556-ABA3-BD23AF487F12

to

E771BBEC-ACC6-489C-B7C1-B5FF11004CB2/

NSHomeDirectory() is changing everytime I run the app in simulator.


回答1:


Don't save the full path, but just the directory and file name to the images. Since this behavior is new in iOS 8 and can also happen on a real device.




回答2:


save your file path like as follows :

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];

NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:[[yourArray objectAtIndex:indexPath.section]lastPathComponent]];



回答3:


i think you have this link in your code NSDocumentationDirectory change it into NSDocumentDirectory

NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);


来源:https://stackoverflow.com/questions/28942897/application-folder-name-changes-every-time-i-run-in-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!