包路径与沙盒路径

    NSString *homeDirectoryPath = NSHomeDirectory();

    

    NSString *px = [NSBundle mainBundle].bundlePath;

    

    NSLog(homeDirectoryPath);

    NSLog(px);

2017-07-18 12:57:32.234 CEStatRecordDemo[16284:2199388] /Users/zzf073/Library/Developer/CoreSimulator/Devices/96C38E7B-35FF-49AC-80A1-BCAA1E8E7873/data/Containers/Data/Application/7D8F22C1-5990-4FB6-AB17-1787D074C959

2017-07-18 12:57:32.235 CEStatRecordDemo[16284:2199388] /Users/zzf073/Library/Developer/CoreSimulator/Devices/96C38E7B-35FF-49AC-80A1-BCAA1E8E7873/data/Containers/Bundle/Application/5FA3A1A9-09C8-425C-838F-C54D368D5A8D/CEStatRecordDemo.app

可执行文件包路径和运行数据路径不是一回事。

原文地址:https://www.cnblogs.com/feng9exe/p/7199949.html