Ios16 : Can't get saved image
system : ios16 step1 : Save image to photo album use path : Application.persistentDataPath .. "/NGallery/XXX.jpg" step2 : Get image from Application.persistentDataPath .. "/NGallery/XXX.jpg", but report an error with "Load fail" step3 : Check the photo album , I see the photo just saved.
Also , I load the image with other plugin's function is failed too
Are you deleting the image from persistentDataPath after saving it? If not, why does load fail? Are there specific error messages? Note that the image is copied to photo album so the image at persistentDataPath isn't the same image file that exists in Photos.
I didn't delete the image. I lost the erro log. You can have a try.
First: NativeGallery.SaveImageToGallery;
Second: path = Application.persistentDataPath .. "/NGallery/XX_share.jpg" local img = NativeGallery.LoadImageAtPath(path, -1, true, true, false) if img then logRed("load image :" .. img.name) end
I don't have an iOS or Mac workstation so I can't give it a try myself. Please let me know if you find any related error messages that might help. Also seeing the code itself might help.
I don't have an iOS or Mac workstation so I can't give it a try myself. Please let me know if you find any related error messages that might help. Also seeing the code itself might help.
I meet similar problem. After i called the SaveVideoToGallery, the callback returned success but the path is empty. Btw, on android in the callback the path returned correct path string.
NativeGallery.Permission permission = NativeGallery.SaveVideoToGallery( outputVideoPath, "GalleryTest", videoName, ( success, path ) => { Debug.Log( "Media save result: " + success + " " + path ); Debug.Log( "Video path: " + path ); //Handheld.PlayFullScreenMovie( "file://" + path ); } );
Media save result: True UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) <>c:<SaveVideoToAlbumCoroutine>b__64_0(Boolean, String) NativeGallery:SaveToGalleryInternal(String, String, MediaType, MediaSaveCallback) NativeGalleryNamespace.NGMediaSaveCallbackiOS:OnMediaSaveCompleted(String)
Video path: UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) <>c:<SaveVideoToAlbumCoroutine>b__64_0(Boolean, String) NativeGallery:SaveToGalleryInternal(String, String, MediaType, MediaSaveCallback) NativeGalleryNamespace.NGMediaSaveCallbackiOS:OnMediaSaveCompleted(String)
@ojama That's expected as per documentation:
MediaSaveCallback takes bool success and string path parameters. If the image/video is saved successfully, success becomes true. On Android, path stores where the image/video was saved to (is null on iOS). If the raw filepath can't be determined, an abstract Storage Access Framework path will be returned (File.Exists returns false for that path)