Replies: 6 comments
-
Add SBAppUsesLocalNotifications true to your Info.plist, then notifications will work |
Beta Was this translation helpful? Give feedback.
-
@opa334 like this? <key>SBAppUsesLocalNotifications</key>
<true/> I'm not getting the stock alert |
Beta Was this translation helpful? Give feedback.
-
Yes, there will be no stock alert, notifications will just work (and they can be configured inside Settings -> Privacy too) |
Beta Was this translation helpful? Give feedback.
-
I've tried this code but there's no notification func postNotification() {
let content = UNMutableNotificationContent()
content.title = "Cathal"
content.body = "Well done! You've completed a Pomodoro session. Starting break now.."
content.sound = UNNotificationSound.default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
let request = UNNotificationRequest(identifier: "pomodoroDone", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
} I'm calling it in |
Beta Was this translation helpful? Give feedback.
-
my bad, settings -> notifications is what you want to look at, also you still have to request authorization for notifications at least once before sending one, this won't show a permission alert tho because it's a system app |
Beta Was this translation helpful? Give feedback.
-
@opa334, Still no notifs with this code :/ .onAppear {
timerViewModel.requestAuthorization()
DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
timerViewModel.postNotification()
}
} But the app ain't showing up at all in that menu either, so ig the problem is something else. If you want to try it out here's the app. Appreciate the help anyways |
Beta Was this translation helpful? Give feedback.
-
What are the steps to reproduce this issue?
viewDidLoad
method or the equivalent:What happens?
Nothing
What were you expecting to happen?
For the app to display a stock iOS alert that asks the user wether they'd like to give access to the app to send them notifications
Paste any relevant logs, error output, etc.
No response
Additional context
This same code works in the same app if it's compiled as an ipa and sideloaded. My guess is that since the sideloaded app shows at the bottom of the settings app like if it was a regular app, that's what makes it work since iOS thinks it's a stock app and treats it like so.
What OS are you seeing the problem on?
Linux/WSL
What OS version does it have installed?
Kubuntu 21.04
What toolchain and version are you using?
Swift toolchain 5.3.2
Which SDK version are you using?
iOS 14.5
What OS is your client device running?
iOS
What OS version does it have installed?
iOS 14.5.1
Which device model is it?
iPod touch 7th generation
Which jailbreak is it using (if relevant)?
Checkra1n
Beta Was this translation helpful? Give feedback.
All reactions