If you want to capture DNS traffic, use a DNS proxy provider.
But isn't using the DNS proxy provider requires a special permission from Apple? I'm developing an SDK that will be used as by 3rd party clients. This is why I decided to go with the Packet Tunnel provider instead.
Post
Replies
Boosts
Views
Activity
Hi, did you ever manage to solve this issue? I am currently facing it too, but I can't seem to find any solution.
You could use a stored lastUpdated date and compare it on each launch:
@main
struct SwifUIPlayGroundApp: App {
@AppStorage("lastUpdated") var lastUpdated = Date()
private var shouldUpdate: Bool {
let now = Date()
let hoursInYear = 8760
guard let hoursPassed = Calendar.current.dateComponents([.hour], from: lastUpdated, to: now).hour else { return false }
return hoursPassed >= hoursInYear
}
init() {
if shouldUpdate {
lastUpdated = Date() // Set it to now
print("Loading...")
} else {
print("No need to relaod...")
}
}
}