Post

Replies

Boosts

Views

Activity

How do I get all Consumable IAP Transactions with StoreKit 2
Hey all, I've been using StoreKit 2 lately and I'm so deeply impressed with how much easier it has become. For a better user experience regarding transaction history, I've built a view that would show every transaction made in the past with the option to request a refund natively. The only problem I'm facing at the moment is that I can't seem to get a list with all transactions, my app has Non-consumable, Consumable and Subscription IAP and I only get the Non-consumable + Subscriptions when I use the Transaction.all Does anyone have any idea how I can get the Consumable transactions as well? Current code @MainActor     func getPurchasedProducts() async {         //Iterate through all of the user's purchased products.         for await result in StoreKit.Transaction.all {             if case .verified(let transaction) = result {                 if !self.transactions.contains(transaction) {                     self.transactions.append(transaction)                     self.transactions = sortByDate(self.transactions)                 }             }         }     }
2
0
3k
Aug ’21
The SwiftUI way of having multiple pages on watchOS
Hello, I'm looking for a way I can achieve multiple pages on watchOS in the new SwiftUI App Structure. In Storyboard you can set a relationship segue "next page". But does anyone know how to achieve this in SwiftUI without using storyboards. I expected to find something for this in WindowGroup but without success. Or do I need to change my design to have one screen instead.
1
0
820
Aug ’20
WKExtendedRuntimeSession doesn't work when I use SwiftUI
Hello, Recently I've been hitting on a problem when using WKExtendedRuntimeSession with SwiftUI I have created a ObservedObject like this: @ObservedObject var store = TimerStore() when the view appears I call upon store.startTimer() the timer store object looks like this: class TimerStore : NSObject, ObservableObject, WKExtendedRuntimeSessionDelegate {     @Published var secondsPassed : Int {         didSet { didChange.send() }     }     var timer : Timer!     var extSession: WKExtendedRuntimeSession!     init(seconds: Int = 0) {         self.secondsPassed = seconds     }     var didChange = PassthroughSubject<Void, Never>()          func startTimer() {         timer = Timer.scheduledTimer( timeInterval: 1, target: self,   selector: (#selector(self.updateSeconds)), userInfo: nil, repeats: true )         startSession()     }     @objc func updateSeconds() {         self.secondsPassed += 1     }     func startSession() {         extSession = WKExtendedRuntimeSession()         extSession.delegate = self         extSession.start()     }     func stopSession() {         extSession.invalidate()         timer.invalidate()     }     func extendedRuntimeSession(_ extendedRuntimeSession: WKExtendedRuntimeSession, didInvalidateWith reason: WKExtendedRuntimeSessionInvalidationReason, error: Error?) {         print("Session stopped: \(Date())")     }     func extendedRuntimeSessionDidStart(_ extendedRuntimeSession: WKExtendedRuntimeSession) {         print("Session started: \(Date())")     }     func extendedRuntimeSessionWillExpire(_ extendedRuntimeSession: WKExtendedRuntimeSession) {         print("Session expired: \(Date())")     } } When I debug it with my phone attached it offers no problems and it clearly prints out the start and end of the session, even after waiting for 10min (when the session would be expired), however when I keep using the app after debugging the extended runtime session doesn't work anymore on the device. I've tried a lot but it's blowing my mind. When talking with a Apple developer via Labs last week he said it could be because views in SwiftUI are not permanent . I do get it to work when I use a storyboard + WatchKit Does anyone has any idea how I can potentially fix this?
3
0
1.5k
Jul ’20