My app crashes everytime it tries to remove a snapshot. It happens on the device (android), but not while running on Simulator.
-- Invalidates snapshot at every frame
local function invalidateSnapshot()
snapshot.invalidate()
end
-- Called when removing the snapshot
function removeSnapshot()
-- Stopping the update of the snapshot
Runtime:removeEventListener("enterFrame", invalidateSnapshot)
-- Removing the snapshot
if snapshot ~= nil then
if snapshot.group ~= nil then
snapshot.group:removeSelf()
snapshot.group = nil
end
snapshot:removeSelf()
snapshot = nil
end
end
Here’s the error:
WARNING: script.lua:18: the ‘group’ property of snapshot objects is read-only
snapshot:removeSelf() seems to be the reason it crashes. There’s a function that invalidates that snapshot onEnterFrame, but I do stop it right before removing the snapshot.
Weird thing is that I can’t find a single thing on google about “snasphot boject being read-only”.