Two status bar in the app when application comes in foreground from background and UI freezes in iOS
<p>I am working on an iOS app in which I have to do <code>numerous calculations in the loop which is running say 5000 times on the main thread</code>. So its taking a little bit time before loading the UI and activity indicator is loading till then.If the app goes background and comes back to foreground the UI <strong>freezes</strong> for the time till the app completes the loop operation.</p>

<p>One specific thing that I found is that I am getting <strong>two status bar</strong> in the app which is overlapping each other.you can see <code>time and battery percentage</code> value overlapping each other (Refer Screen Shot below).This only happens when app goes to background and comes back to foreground <code>freezing my Activity Indicator</code>. Even though if I want to replace the activity with a new one or stop and start it again still there is no response and the UI is freezes unless the loop completes its iteration and sometimes leading to <strong>app crash</strong> as well.</p>

<p>If app calculation is completed (normal case) and then if app goes to back ground and comes back then every thing works smoothly.</p>

<p><a href="https://i.stack.imgur.com/hqiLY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hqiLY.png" alt="enter image description here"></a></p>

<p>Please suggest me whats going wrong with my app.</p>