Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SKStoreReviewController buttons hidden under keyboard

My swift iOS app has an active textfield with keyboard showing. Everytime user taps the return key on keyboard, I call

SKStoreReviewController.requestReview()

This may sound excessive but once the user has given the review, above statement will not do anything so I think my approach is correct.

Problem is that on smaller screen devices (iPhone 5 etc), the displayed SKStoreReviewController's buttons are hidden under the keyboard.

So the user gets stuck as they cannot dismiss the SKStoreReviewController. I do not want to add a keyboard hide button for the user.

How can I know when SKStoreReviewController did display so I can programmatically hide the keyboard?

like image 436
Kashif Avatar asked Sep 09 '17 15:09

Kashif


1 Answers

There is no way for you to tell if it is being displayed.

You can read the documentation on SKStoreReviewController here, which shows only the requestReview() function you use to call it.

But, if you want to dig deeper, I provide the following screenshot which shows what the Debug View Hierarchy looks like while displaying the request.

enter image description here

What this tells you, is that there is nothing you can try to dig down to via properties such as presentedViewController in an attempt to divine if the screen is being presented.

Normally, if you are presenting a UIAlertController, or any UI element for that matter, you will see the UI pieces stacked together that form it, indicating that you can access associated properties to find out what is being presented. With this class, none of that is provided so your app is oblivious to what is going on.

The following screenshot illustrates what a view hierarchy looks like when you have multiple elements on the screen:

enter image description here

As Apple alludes to in the class documentation, you need to develop your own logic for presenting it at a time when it will not present the issue you are currently experiencing.

like image 67
CodeBender Avatar answered Oct 26 '22 01:10

CodeBender