Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

ios - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...