admin管理员组文章数量:1391987
I have a purchase manager class and an entitlement manager class. Everything is working great, but this code is not working.
init(entitlementManager: EntitlementManager) {
self.entitlementManager = entitlementManager
super.init()
self.updates = observeTransactionUpdates()
SKPaymentQueue.default().add(self)
}
extension SubscriptionsManager: SKPaymentTransactionObserver {
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
}
func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment, for product: SKProduct) -> Bool {
return true
}
}
The Xcode warning message is:
SKPaymentQueue was deprecated in iOS 18.0: No longer supported
SKPaymentTransaction was deprecated in iOS 18.0: Use PurchaseResult from Product.purchase(confirmIn:options:)
I want to support in-app purchases from the App Store. How should I do this?
I have a purchase manager class and an entitlement manager class. Everything is working great, but this code is not working.
init(entitlementManager: EntitlementManager) {
self.entitlementManager = entitlementManager
super.init()
self.updates = observeTransactionUpdates()
SKPaymentQueue.default().add(self)
}
extension SubscriptionsManager: SKPaymentTransactionObserver {
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
}
func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment, for product: SKProduct) -> Bool {
return true
}
}
The Xcode warning message is:
SKPaymentQueue was deprecated in iOS 18.0: No longer supported
SKPaymentTransaction was deprecated in iOS 18.0: Use PurchaseResult from Product.purchase(confirmIn:options:)
I want to support in-app purchases from the App Store. How should I do this?
Share Improve this question edited Mar 26 at 5:25 HangarRash 15.1k5 gold badges20 silver badges55 bronze badges asked Mar 15 at 10:00 kjfhkekjfhke 11 bronze badge 1- Use StoreKit 2 functions – Paulw11 Commented Mar 15 at 10:06
1 Answer
Reset to default 0StoreKit 2 is the new standard and you can implement a store with all the basic functionality
import SwiftUI
import StoreKit
struct BirdFoodShop: View {
@Query var birdFood: [BirdFood]
var body: some View {
StoreView(ids: birdFood.productIDs)
}
}
//Or a produxt button
ProductView(id: product.id)
Meet StoreKit 2 can walk you through all the basics and Meet StoreKit for Swiftui will walk you through the newest views.
Here is some sample code
https://developer.apple/documentation/StoreKit/implementing-a-store-in-your-app-using-the-storekit-api
https://developer.apple/documentation/SwiftUI/Backyard-birds-sample
本文标签:
版权声明:本文标题:swift - Supporting in app purchases from the App Store. SKPaymentQueue deprecated. Use purchase(confirmIn:options:) - Stack Over 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744618764a2615893.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论