It works for me only in sheet presentation, and only first time (when I only open this screen, not another one before!).
And if I hide my screen with toolbar in my app by menu presentation and open it again (here the screen is not hidden or closed).
I think, view rebuilds itself again and all custom buttons in toolbar are visible. WTF with Apple Dev??
Post
Replies
Boosts
Views
Activity
If we were interested in this unexpected behavior in my application, I already know a reason. Everything is simple! If your subscription is rejected during AppStrore review with the reason of bad description, you can see in your product only the price.
🥵 There was a problem in this section 🥵
Better use it:
///Check the subscription to determine whether the user is eligible for an introductory offer.
public func isEligibleForIntro() -> Bool {
let selectedProduct = subscriptions.first(where: { $0.id == selectedProductID })
return selectedProduct?.subscription?.introductoryOffer?.type == .introductory
}
Because with https://developer.apple.com/documentation/storekit/product/subscriptioninfo/3803203-iseligibleforintrooffer/
func eligibleForIntro(product: Product) async throws -> Bool {
guard let renewableSubscription = product.subscription else {
// No renewable subscription is available for this product.
return false
}
if await renewableSubscription.isEligibleForIntroOffer {
// The product is eligible for an introductory offer.
return true
}
return false
}
I have a problem with the implementation in View...
Thanx @AaronIntohand
/// Sorry, it's not answer for your issue... ///
What I've not seen in your transaction:
///Always finish a transaction.
await transaction.finish()
Next code looks like extra:
if purchasedProductIDs != self.purchasedProductIDs { self.purchasedProductIDs = purchasedProductIDs }
I use this, Set uses only unique values:
if transaction.revocationDate == nil {
self.purchasedSubscriptions.insert(subscription)
} else {
self.purchasedSubscriptions.remove(subscription)
}
Typically, Task is used as follows:
Task(priority: .background) {}
The value var hasUnlockedPro: Bool is better stored in @AppStorage.
Hi, I get this message when the call of "super.method" is not correct:
override func viewDidAppear(_ animated: Bool) {
super.viewWillAppear(animated)
///your code...
}
As you can see - viewWillAppear inside viewDidAppear 🤬 )))
It’s a warning, not an error. It says your toolbar content view is 0 in width but you’re also trying to stretch it be 16 from leading and trailing edge.
I wouldn’t care about it unless something breaks... 🤓
https://stackoverflow.com/questions/56700752/swiftui-half-modal#:~:text=23-,iOS,-16%2B
I hope it will help you)
⚠️ do not forget to add .navigationViewStyle(.stack) to Navigation View. It will deinit() the view model ⚠️
But it's also important to kill all objects in the ViewModel to clear the memory graph. When you use Combine for example))
Without it, the Debug Navigator will tell you about warnings.
Add to ViewModel:
`public func invalidate() {
cancellable?.cancel()
cancellable = nil
print("[<<] invalidated")
}
And call in MySwiftUIView():
` .onDisappear {
vm.invalidate()
}
in AppDelegate()
//Get ID Token on Debug Console for A/B Testing (hide when unused!)
////////////////////////////////////////////////////////////////
Installations.installations().authToken { result, _ in
print("\nYour instance ID token is -> (result?.authToken ?? "n/a") <-\n")
}