At one level, the issue with objects not being able to removeSelf is usually caused by the object already having been removed from the display somehow.
One sure fire way to avoid the error is to test for the presence of removeSelf() as a method *before* calling it. This can be done as so
[lua]
if( rect.removeSelf ~= nil ) then – Make sure it is still in the display hierarchy
rect:removeSelf()
end
[/lua]
However, this does not solve any fundamental issues code may have with symmetrical loading / releasing of assets. It’s just a method to check that objects actually are in the display hierarchy before deleting them. (The removeSelf method is added to the object when inserted into the display, and the mthod is removed when the object is removed from the display).
Don’t think I’ve every seen this trick posted in the forums, hopefully a corona staffer won’t jump in here and blast me out of the water on this technique… But it seems to work as a last ditch stopgap.