Search code examples
safariios-simulator

iOS Device Simulator on Mac getting "crypto.randomUUID is not a function"


I'm not really understanding why I'm seeing this error crypto.randomUUID is not a function when viewing said web app on iOS Simulator's Safari, when simulating any of the devices (iPad, iPhone, etc). I understand what the error means, I'm just surprised that randomUUID is not supported. It works on any other desktop browser, including physical iPad and iPhone devices. Is the simulator lacking something that I'm not understanding that needs configuration? I assume the simulator should be faithful to the actual hardware.

enter image description here


Solution

  • No one has answered this yet and you've probably solved this on your own already. Most of version 15 doesn't support crypto. IIRC versions 15.0 through 15.3 (maybe i think even to 5); Anything after that is fine. I say maybe because Apple doesn't state this anywhere as far as I'm aware. I've discovered this on my own through testing for work.

    This hacky but you can get around this by adding a polyfill (I know it stings) I wouldn't expect Apple to remedy this any time soon because it feels like they gave up on Safari IMO.