presentNoticeSheet()
Presents a notice sheet from Apple that informs people of external purchases before showing them, and determines if your app can present external purchases
Declaration
static func presentNoticeSheet() async throws -> ExternalPurchase.NoticeResultMentioned in
Return Value
This method returns ExternalPurchase.NoticeResult.
Discussion
This method is only available to apps with the com.apple.developer.storekit.external-purchase entitlement. For more information, see ExternalPurchase.
Call this method each time your app is ready to present an external purchase. To use this method, follow these steps:
Call canPresent. If it’s
false, don’t call presentNoticeSheet() and don’t show external purchases.If canPresent is
true, display buttons or other user-interface elements to enable deliberate user interaction. Then, in response to a deliberate user interaction such as tapping a button, call presentNoticeSheet() as shown below:
try await ExternalPurchase.presentNoticeSheet()If the result is ExternalPurchase.NoticeResult.continuedWithExternalPurchaseToken(token:) your app can show external purchases. Otherwise, you must not show external purchases.
This method throws a StoreKitError in any of the following conditions:
The current App Store storefront doesn’t support external purchases.
The person is ineligible to make external purchases.
Your app doesn’t have the necessary entitlement.
Your app doesn’t configure external purchase for the current App Store storefront in SKExternalPurchase when it has the com.apple.developer.storekit.external-purchase entitlement.
A network or system error occurs.
This method also throws a StoreKitError if its functionality is unavailable for the following reasons:
Your app is built with Mac Catalyst and you compile with an SDK earlier than iOS 17.4 or iPadOS 17.4.
Your app is a compatible iPad or iPhone app running in macOS or visionOS and uses an SDK earlier than iOS 17.4 or iPadOS 17.4.
For apps compiled with SDKs earlier than iOS 17.4 or iPadOS 17.4, your app can show external purchases if the result is ExternalPurchase.NoticeResult.continued.