No it dosn’t crash, the rest of game keeps working.
I only ever got it to work in html5 in android. not sure how to check the log there.
In html5 on Pc it says:
Sharing Error: TypeError: Cannot read properties of null (reading ‘1’)
screenshot.png(function(self, img, w, h)
pprint(img)
if not img == nil then
share.image(img, "Lorem ipsum etc etc", "score.png")
else
print("img is nil")
end
end)
woops thanks for the clarification!
fixed code to this:
print("sharing image")
screenshot.png(function(self, img, w, h)
pprint(img)
if img ~= nil then
share.image(img, "Mira sa meva puntuacio amb es joc de l'EMT!\nFes click aqui per jugar https://emt2048.netlify.app/", "score.png")
else
print("img is nil")
end
end)
now im back to the initial error message i got before:
Yes it works on macOS when testing in Safari. Firefox and Chrome doesn’t work (which seems to be according to spec). Perhaps it’s possible to request a sharing permission or something?
Are you sure its acording to spec? Mdn web docs share the Navigator.share example in this page works fine on chrome and firefox. No need to request permission.
I just tested the min project on a collegues mac using safari and I get the same permission error. Mdn web docs share both examples work for me, including the sharing .png example. So the permission error should not be triggering since .png is an allowed file type in the spec.