Apple has released a patch for a zero-day vulnerability for its iPhones and iPads that affected almost all models.