Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SKStoreReviewController is deprecated in iOS 18, and replacement is not accesible in MAUI. #21410

Closed
PureWeen opened this issue Oct 10, 2024 · 6 comments · Fixed by #21441
Closed
Assignees
Labels
enhancement The issue or pull request is an enhancement
Milestone

Comments

@PureWeen
Copy link

Moved from dotnet/maui#25169

Description

Hello,

with iOS 18 it seems that Apple deprecated SKStoreReviewController. Now every plugin and call made from SKStoreReviewController are not working. There is a replacement with AppStore.requestReview(in: scene). But from MAUI it is inaccessible.

https://developer.apple.com/documentation/storekit/appstore/3954432-requestreview/

Steps to Reproduce

Create an application
on ios18 invoke

if (UIApplication
                            .SharedApplication?
                            .ConnectedScenes?
                            .ToArray<UIScene>()?
                            .FirstOrDefault(x => x.ActivationState == UISceneActivationState.ForegroundActive) is UIWindowScene windowScene)
                    {
                        SKStoreReviewController.RequestReview(windowScene);
                        return Task.CompletedTask;
                    }

see that application hangs.

same code on iOS 17.5 works, create a review popup or just passes quietly.

Link to public reproduction project repository

No response

Version with bug

8.0.91 SR9.1

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 18+

Did you find any workaround?

No

Relevant log output

No response

@rolfbjarne
Copy link
Member

AppStore.RequestReview looks like a really simple API, so we might be able to bind it manually.

I'll see what I can do.

@rolfbjarne rolfbjarne self-assigned this Oct 15, 2024
@rolfbjarne rolfbjarne added this to the Future milestone Oct 15, 2024
rolfbjarne added a commit that referenced this issue Oct 15, 2024
The existing Objective-C class to request an App Store review (SKStoreReviewController)
is deprecated in Xcode 16+, and it doesn't even work on the corresponding OS versions.

The replacement API is Swift-only, but luckily it's a very simple API (just a static
method), so it's possible to bind it manually.

This required a few other changes/improvements:

* Add support for Swift code in our runtime.

* Just to keep the changes to a minimum, bump the min OS version for legacy code
  to match the .NET min OS versions. This is because our build logic uses the legacy
  min versions when compiling native code (a more involved fix would be to update
  all the build logic to build native code to use the .NET min OS versions, but that's
  not the point of this PR, so I took the easy route).

I've tested the method locally, and it seems to work fine, but I've still marked
it as experimental for now. There are no unit tests because calling the method will
put up a dialog, which won't work correctly in unit tests.

Fixes #21410.
@rolfbjarne
Copy link
Member

We're binding this as an experimental API named StoreKit.AppStore.RequestReview(UIWindowScene).

@MerSpyro
Copy link

MerSpyro commented Oct 17, 2024

@rolfbjarne @PureWeen
Could you provide information when and where this fix will be available? Im not too sure where I'd go to look for this, in .net release, MAUI release or somewhere else?

@rolfbjarne thanks for this extremely swift binding of new API!

@rolfbjarne
Copy link
Member

@rolfbjarne @PureWeen Could you provide information when and where this fix will be available? Im not too sure where I'd go to look for this, in .net release, MAUI release or somewhere else?

This will be in an update to the iOS workload, most likely when we add support for Xcode 16.1 (which will probably happen soon after .NET 9 has been released, although this depends a bit on when exactly Apple makes Xcode 16.1 stable).

@tipa
Copy link

tipa commented Oct 17, 2024

Can the same be considered for the reloadAllTimelines() method?
I am currently using this workaround (in combination with an app extension written in Swift) but it adds quite a bit of boilerplate to my projects.

@rolfbjarne
Copy link
Member

Can the same be considered for the reloadAllTimelines() method? I am currently using this workaround (in combination with an app extension written in Swift) but it adds quite a bit of boilerplate to my projects.

I filed a suggestion for this: #21466

haritha-mohan pushed a commit that referenced this issue Oct 19, 2024
The existing Objective-C class to request an App Store review (SKStoreReviewController) is deprecated in Xcode 16+, and it doesn't even work on the corresponding OS versions.

The replacement API is Swift-only, but luckily it's a very simple API (just a static method), so it's possible to bind it manually.

This required a few other changes/improvements:

* Add support for Swift code in our runtime.

* Just to keep the changes to a minimum, bump the min OS version for legacy code to match the .NET min OS versions. This is because our build logic uses the legacy min versions when compiling native code (a more involved fix would be to update all the build logic to build native code to use the .NET min OS versions, but that's not the point of this PR, so I took the easy route). Fixes #10659.

I've tested the method locally, and it seems to work fine, but I've still marked
it as experimental for now. There are no unit tests because calling the method will
put up a dialog, which won't work correctly in unit tests.

Fixes #21410.
Fixes #10659.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue or pull request is an enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants