Writing/reading to paths with interleaved double dots fails on iOS 8
问题 This code fails on iOS 8, although it would work on iOS 7 UIImage *imageTest = ... NSString *file = @"../Documents/Test.png"; NSString *fullpath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent: file]; [UIImagePNGRepresentation(imageTest) writeToFile: fullpath atomically: YES]; UIImage *image = [UIImage imageNamed: file]; On iOS 8 I need to use this instead NSString *file = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]