I am using cocos2d-x v2.6 (C++, XCode)
I want to save CCRenderTexture into PNG files (in this case on iOS 7 - iPhone 5)
Saving success, but I am searching on Gallery no Image found.
Also, I don’t think you’ll be able to use a specific filename. iOS don’t really work like that: iOS tend to hide as much as possible the filesystem from the user, so the camera roll doesn’t keep images filename.
//get the path to the Documents directory
NSArray* paths = NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsDirectory = [paths objectAtIndex:0];
NSString* screenshotPath = [documentsDirectory stringByAppendingPathComponent:file];
NSLog(@"copy from: %@",screenshotPath);
//get the screenshot as raw data
NSData *data = [NSData dataWithContentsOfFile:screenshotPath];
//create an image from the raw data
UIImage *img = [UIImage imageWithData:data];
//save the image to the users Photo Library
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);