diff --git a/cocos/platform/ios/CCImage-ios.mm b/cocos/platform/ios/CCImage-ios.mm index 453f444479..7af8f39c1d 100644 --- a/cocos/platform/ios/CCImage-ios.mm +++ b/cocos/platform/ios/CCImage-ios.mm @@ -25,6 +25,7 @@ THE SOFTWARE. ****************************************************************************/ #import "platform/CCImage.h" #import "platform/CCCommon.h" +#import "platform/CCFileUtils.h" #import #import @@ -111,7 +112,9 @@ bool cocos2d::Image::saveToFile(const std::string& filename, bool isToRGB) } else { data = UIImageJPEGRepresentation(image, 1.0f); } - [data writeToFile:[NSString stringWithUTF8String:filename.c_str()] atomically:YES]; + + auto outStream = FileUtils::getInstance()->openFileStream(filename, FileStream::Mode::WRITE); + outStream->write(data.bytes, data.length); } [image release];