iOS Human Interface Guidelines - Status Bar tells that the Status bar should not be customised.
Use the system-provided status bar. People expect the status bar to be consistent systemwide. Don’t replace it with a custom status bar.
My understanding is that it refers to the UI not the background-color.
Obscure content under the status bar. By default, the background of the status bar is transparent, allowing content beneath to show through. Keep the status bar readable and don’t imply that content behind it is interactive. There are several common techniques for doing this:
- Use a navigation bar in your app, which automatically displays a status bar background and ensures that content doesn’t appear under the status bar.
- Display a custom image, such as a gradient or solid color, behind the status bar.
- Apply a blur to the content behind the status bar.
As you can see the second point states: "Display a custom image, such as a gradient or solid color, behind the status bar"
My interpretation is that it is ok to use a background-color for the Status bar, keeping the bar with the same UI as the OS and the text-color white or black.
As @Harshith points in his answer, Google recommends doing so for Android.
According to iOS Human Interface Guidelines - Branding:
Incorporate refined, unobtrusive branding. People use your app to be entertained, get information, or get things done, not to watch an advertisement. For the best experience, subtly incorporate your brand through your app’s design. Using colors from your app icon throughout your interface is one great way to provide context in your app.
It doesn't explicitly mention the Status and Navigation bars, however it encourages the use of your brand (app icon) colors in the interface.