Hi,
I am trying to use the share extension to share an image that I took using the screenshot extension. But strangely, nothing happens when I press the share button. Any ideas what may be going wrong?
[data is my player data]
local png, w, h = screenshot.png()
local f = io.open(sys.get_save_file(sys.get_config("project.title", "screenshot"), "screenshot"..(data.DATA.SCREENSHOTS)..".png"), "wb")
data.DATA.SCREENSHOTS = data.DATA.SCREENSHOTS + 1
f:write(png)
f:flush()
f:close()
if share then
share.file(sys.get_save_file(sys.get_config("project.title", "screenshot"), "screenshot"..(data.DATA.SCREENSHOTS)..".png"), "Racing with some bits on BitRiders. ")
end
In your example you write png into file screenshot+N and then increase N variable, that means that in share.file function you have filename screenshot+(N +1) but this file still does not exist.
Could you please try to remove this logic with the counter and check it with statically predefined filename, to be sure that problem in sharing extension.
There is no error handling built into the sharing extension. On Android it logs the error but does nothing more. It would be a good addition if share.file() would return a boolean+error message. If you need it then create an issue on GitHub, or even better submit a pull request!