Hello,Sometimes, this piece of code opens iPhone Settings (instead of app Settings)let url = URL(string: UIApplication.openSettingsURLString)
UIApplication.shared.open(url!, options: [:], completionHandler: nil)But other times, it opens app settings, as the documentation says.(I am using iPhone X and iOS 12)I think the reason is that when the app does not appear in the settings list (because it is the first time that app is exectured), then openURL does not know how to open app settings (because it does not exist) and opens iphone settings. To test that, create an app with those 2 lines of code. And remember to reset the simulator entirely to test the wrong case.Do you have or see the same problem?Thanks a lot.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I created a small component using a Text and optionally an Image, inside an HStack. Then I apply padding and clipping using a Capsule shape.
Below you have the code and the results.
The problem I have is that I want to constraint the component in a way that the width is always equal or higher than its height. That is, a vertical capsule is not allowed, only an horizontal capsule or a circle.
I tried different approaches.
For example, measure the component size using Geometry reader. We can use the .measure modifier, which basically puts everything inside .background and applies a Geometry Reader, and moves the value up using Preference Keys.
Measure modifier:
swiftuirecipes.com/blog/getting-size-of-a-view-in-swiftui
But it does not work, looks like the HStack is returning zero, or causing issues.
In any case, I was told to avoid GeometryReader whenever possible.
What other approaches I could follow?
There must be a way playing with .background and .layoutPriority, butI don't know exactly how to do it.
Would be nice to have something like an .aspectRatio modifier where we can pass something like "1 or higher", but I have no idea about how to implement that.
Do you have any idea or suggestion? Thanks a lot.
[![enter image description here][1]][1]
struct ContentView: View {
var body: some View {
VStack(spacing: 20) {
Label(text: "2", showIcon: true)
Label(text: "99+", showIcon: true)
Label(text: "1", showIcon: false) // Case to fix
}
}
}
struct Label: View {
let text: String
let showIcon: Bool
var body: some View {
HStack {
if showIcon {
Image(systemName: "bolt")
.resizable()
.frame(width: 15, height: 15)
}
Text(text)
}
.padding(4)
.background(Color.red)
.clipShape(Capsule())
}
}
Hello,Suddenly my distribution certificate disappeared, invalidating all my provisioning profiles.Is it possible to see a log or similar to know what happended?Will Xcocde delete a certificate if I activate the "Automatically manage signing" checkbox?Thanks.
How do I detect a refund? (question about cancellation_date)
My system uses auto-renewal subscriptions.
After reading this document:
https://developer.apple.com/library/archive/technotes/tn2413/_index.html#//apple_ref/doc/uid/DTS40016228-CH1-RECEIPT-HOW_DO_I_USE_THE_CANCELLATION_DATE_FIELD_
I am not sure about how to manage the refund scenario.
The docs say that I have to check cancellation_date field. But what I don’t know is WHEN I will receive that.
When the user requests a refund to apple and apple accepts it, will my app receive a new transaction in
func paymentQueue(_ queue: SKPaymentQueue,
updatedTransactions transactions: [SKPaymentTransaction])
the next time the user runs the app?
Or do I have to use polling (my server checks every day with apple server all subscribers) or use server-to-server notifications?
Thanks for clarification.
Hello,
I would like to use “Billing Grace Period”
But there is a scenario I don’t know how to manage.
My app sends the receipt to my server, my server verifies the receipt with apple and then unlocks content.
I am not using server-to-server notifications, basically because I will only have an iPhone app, moreover, seems server-to-server adds more complexity and this is a small project.
The scenario I don’t know how to manage is this:
Imagine I activate the “Billing Grace Period”, then the user, after buying an auto-renewal subscription, cancels it. Because the expiry date in the server takes into consideration graceperiodexpiresdatems, the real expiry date is longer, but my server does not know that the subscription was cancelled, which means the user that cancelled the subscription will always enjoy the grace period.
I think in this case, when cancelling, the app does not receive any transaction or something like that From StoreKit that says that the subscription was cancelled. That is the issue.
In this document:
https://developer.apple.com/documentation/storekit/in-app_purchase/subscriptions_and_offers/reducing_involuntary_subscriber_churn?preferredLanguage=occ
I see:
“When implementing Billing Grace Period, use the verifyReceipt JSON response and server-to-server notifications. ”
So, I would say it is mandatory to use server-to-server notifications to implement “Billing Grace Period” properly. Am I right? Is it totally mandatory?
Thanks a lot.