im redirecting the user to Settings if camera access isn't allowed and user profile page dismiss when the camera permission changed.
UIViewController
dismiss and it goes to previous UIViewController
which is rootViewControllerHow to prevent this situation?
Look at that answer: Having app restart itself when it detects change to privacy settings
The app restarts and you can't prevent this. You can preserve and restore the state: https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/PreservingandRestoringState.html