获取主要目录路径的方式 沙盒目录 NSLog(@"%@",NSHomeDirectory()); MyApp.app NSLog(@"%@",[[NSBundle mainBundle] bundlePath]); tmp NSLog(@"%@",NSTemporaryDirectory()); Documents NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *docPath = [paths objectAtIndex:0]; NSLog(@"%@",docPath); Library NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *libPath = [paths objectAtIndex:0]; NSLog(@"%@",libPath);