yasirkula / UnityNativeCamera

A native Unity plugin to take pictures/record videos with device camera on Android & iOS
MIT License
609 stars 71 forks source link

NativeCameraNamespace.NCCameraCallbackAndroid.MediaReceiveCallback NullReferenceException #117

Open onetech-dev opened 7 months ago

onetech-dev commented 7 months ago

Hello @yasirkula

First of all, thank you for the great plugin

When using NativeCamera.Permission permission = NativeCamera.TakePicture((path) => {...}, it open the device's camera. I took the picture below: Screenshot_20240226_145230_Camera 1

Click OK and device logs NullReferenceException. Full log: "NullReferenceException: Object reference not set to an instance of an object. EditProfileView.b__14_0 (System.String path) (at <00000000000000000000000000000000>:0) NativeCameraNamespace.NCCameraCallbackAndroid.MediaReceiveCallback (System.String path) (at <00000000000000000000000000000000>:0)"

Is there something missing? Tested on Android (Galaxy S22, ver 14)

Thanks in advance.

yasirkula commented 7 months ago

Can you put Debug.Logs to see if the returned path is null?

onetech-dev commented 7 months ago

Hi @yasirkula

Thank you for your reply!

"path" is not null. Full log: "Image path: /data/user/0/bundleID/cache/IMG_camera.jpg". I'm using Unity 2021.3.27f1.

I'm doubting the below lines:

yasirkula commented 7 months ago

Thanks! I'm doubting File.Exists(path) returns false. Could you please check it?