Fixed casting warnings. Added condition to only log if running on simulator or debug build.