“Hello everyone, it works on my Xcode simulator, but not on TestFlight.”
Xcode Simulator
the code >
@State private var isPawall = true
@State private var showPaywall = false
var body: some View {
ZStack {
Color.gradient.ignoresSafeArea()
ScrollView {
VStack(spacing: 30) {
if #available(iOS 17.0, *) {
Text("Welcome to offer a coffee to ")
.font(.system(size: 40.0, design: .serif))
.fontWeight(.semibold)
+ Text("Dozz.")
.font(.system(.title2, design: .serif))
.foregroundStyle(Color.color4)
.bold()
} else {
Text("Welcome to offer a coffee to ")
.font(.system(size: 40.0, design: .serif))
.foregroundColor(Color.colorText)
.bold()
+ Text("Dozz.")
.font(.title2)
.foregroundColor(Color.color4)
.bold()
}
VStack(alignment: .leading, spacing: 40) {
PayWallItemView(payWallItemModel: PayWallModel(
img: "face.dashed.fill",
title: "A big thank you",
description: "Thank you for downloading my app, your support means a lot !"))
PayWallItemView(payWallItemModel: PayWallModel(
img: "dollarsign.arrow.circlepath",
title: "Coffee",
description: "Want to encourage me? Offer me a virtual coffee, it boosts my creativity !"))
PayWallItemView(payWallItemModel: PayWallModel(
img: "heart.circle.fill",
title: "Motivation",
description: "Your help motivates me to continue creating useful and fun apps."))
}
.padding(.top, 50)
Spacer()
if #available(iOS 18.0, *) {
if isPawall == false {
Button {
showPaywall = true
} label: {
Text("Validate")
.foregroundStyle(Color.color1)
.font(.system(size: 20, design: .serif))
.bold()
.padding()
.frame(maxWidth: .infinity)
.background(Color.color4)
.clipShape(.buttonBorder)
.shadow(radius: 4)
}
}
} else {
if isPawall == false {
Button {
showPaywall = true
} label: {
Text("Validate")
.foregroundStyle(Color.color1)
.font(.system(size: 20, design: .serif))
.bold()
.background(Color.color4)
}
.frame(maxWidth: .infinity)
.padding()
.cornerRadius(15)
.shadow(radius: 4)
}
}
}
.padding()
.sheet(isPresented: $showPaywall, content: {
PaywallView()
})
.task {
do {
let customerInfo = try await Purchases.shared.customerInfo()
isPawall = customerInfo.entitlements["pro"]?.isActive ?? false
} catch {
print("Error : \(error.localizedDescription)")
}
}
}
}
}
my iPhone >