Closed olokobayusuf closed 6 years ago
So this is definitely cool. However if someone wants to do something like the following sequence:
SaveToCameraRoll
Share*
If I do copy = false
during Step #1 then I won't be able to share. I still think the right fix is to add a callback for when SaveToCameraRoll
completes.
This is why in iOS they have completionHandler
. I really wish Unity just added something beside SendMessage
to specifically handle callbacks. It's such bad api design not to. Although I guess 3ps can create a lib thats like a messaging bridge.
However if someone wants to do something like the following sequence: ... If I do copy = false during Step #1 then I won't be able to share. I still think the right fix is to add a callback for when SaveToCameraRoll completes.
This would be fine, since you can use the ShareCallback
when calling Share
to delete the file.
This is why in iOS they have completionHandler. I really wish Unity just added something beside SendMessage to specifically handle callbacks. It's such bad api design not to.
I agree with this. We never use UnitySendMessage
because it is very sloppy (you are limited to one string argument). So instead we use C# delegates invoked directly from C++/C/Obj-C. It's much much more flexible, but we have to manually handle threading concerns (because most of the time, the thread that calls back into C# isn't UnityMain, and we all know how Unity hates its API's being called on non-main threads).
Implemented in 230a472027765bb1702ffe53b304560443ab410d
When
copy
is false, the media file will be deleted from the app's private documents directory once it has been added to the camera roll. The default will becopy = true