iOS daily notifications with different content - ios

I'd like to implement daily local notifications, at the same time each day, but with different content. All examples I have seen are with repeating the same content.
In Android I can set an alarm to trigger a portion of my app which then creates the custom content for the day, and pushes that content as notification. How do I do the same in iOS?

Related

Notification/Widget on lock screen with button in Swift

I have an app that contains stopwatch and when time is running and the app enters background I would like to have a notification on lock screen and in Notification Center (when you swipe down). The notification should contain actual time of the stopwatches and user should be able to stop/start the stopwatches.
I was trying to achieve this using UNNotificationContentExtension but as documentation says:
When an iOS device receives a notification containing an alert, the system displays the contents of the alert in two stages. Initially, it displays an abbreviated banner with the title, subtitle, and two to four lines of body text from the notification. If the user presses the abbreviated banner, iOS displays the full notification interface, including any notification-related actions. The system provides the interface for the abbreviated banner, but you can customize the full interface using a notification content app extension.
I found out that I am able to edit just full notification interface which means that when user gets notification and opens it I can show him whatever I want (I tried mediaPlayPauseButtonType to handle stopwatches). But when I check the lockscreen the notification stays default.
What are the possibilities to achieve Notification similar to Spotify - when you play song, you can pause the song and you can see the time etc. from the lockscreen?
Thanks!

iOS Rich Notifications multiple attachments (iOS 10+)

How are multiple attachments handled in the UNMutableNotificationContent?
Per the apple developer documentation, I added multiple attachments to UNMutableNotificationContent.attachments, however only one of the media attachments appears with the notification after the NotificationService is triggered.
Is there a way to get the other attachments to appear?
Seems like multiple attachments still don't work (on iOS 14). Only the first attachment is displayed in either the basic notification (e.g. on the lock screen) or in the notification detail (e.g. after a long press).
So to display multiple attachments in notification detail one needs to implement a custom interface using Notification Content Extension.

Text Block Tableview With Local Notifications Swift IOS

I developed a game and I have a text list. I want to display this text list on tableview cells line by line.
I can display one line on tableview cells. And when the app is on background, I want to display the next line on this text list with local notification. When scheduled local notification is clicked or displayed, and when the app is in the foreground, I want to see that lines. How can I do this?
Edit: I expand my question. I have a text list like this:
Line1: Body: "Hi, I am here" , FireDate: 2 seconds
Line2: Body: "Where are you" , FireDate: 5 seconds
I want to show only "body" content if App is on foreground. And after "firedate" i want to Show the next line on tableview. If App is on background, i want to Show and schedule these lines by local notifications with these firedates. If user opens App, i want to Show these lines in tableview cells.
I know that this question is about local notifications and tableviews. Not for one. Because i dont know where i should start and go. With local notifications or tableviews? I mean that shoul i write the code for tableview and then schedule local notifications? Or together?
Learn and set up your local notification system first. Create your model class(es), send out a local notification, then handle capturing what the user did in the local notification and update your model classes as a result. Focus on that and get it fully working. Add some very simple temporary UI to your app so you can see the results, or simply print messages to console is fine. Dealing with how to reflect your model into a view such as a tableView is completely orthogonal and thus separately solvable. It shouldn't affect your local notification design at all.

Questions about Local notifications in iOS

I'm working on a project on iOS 7, 8 that use a lot of notifications (Remote, Local). I have some questions about Local Notification.
I'm using Local Notification to schedule an alarm or a count-down. As I know, the use of NSTimer is not really a good choice since it has only up to 10' in background & if the app process is killed it doesn't work anymore. Local Notification is managed by iOS but I have to accept its alert when the app is not in foreground. There's nothing like silent local notification (local notification without alert, sound or badge and app still knows about it although it's in background). Am I right ?
Let's assume that there're some simple local notifications in Notification Center, scheduled by our app. Normally when I touch on a notification to see it in my app, the others remain present until we interact with them. In some cases that I haven't figured out, all other notifications are removed from the Notification Center. Does anyone encounter this & understand why ?
I find the interactive notification feature in iOS very limited. I want to change the title of a defined UIMutableUserNotificationAction button & add an image for it, like I can do with UIButton. So the question is : Is it possible to customize the UI of an action button ?
Thanks for your help !
Unfortunately there is no correspondence in silent notification using local notifications.
The number of the visible notification in the notification center is a user decision, the user in Settings can decide to set a different number or decide to do not show them in notification center as well. As for the first point no. The third point is not clear, you can set the image you want for a remote just put in the payload the right name, local notifications use the app icon.
There is no silent notification for Local Notification. The user has to click to the notification to open your App.
I suppose that the associated application has deleted those notifications programmatically. Else, those notifications must stay in the notification center.
You cannot add image to action buttons but just the titles.
I tried more than two weeks to do the same. I had to show notification after 2 hrs even if the use doesn't click the notification. But the repetition facility is well handled in objective C. I could have created multiple local notification but it will also violates the total number of 64 notifications. Apple needs to improved the same.

can we set the functionality of snooze alarm in our app as iphone's built in alarm? [duplicate]

I'm diving into iOS development and am building my own alarm clock app to become familiar with the platform and SDK. One of the API's I'm currently learning is the Local Notifications API, which I assume is the same API Apple uses to implement their alarms in their Clock app.
What I don't understand is how they implement their "Snooze" functionality. As I understand it, Local Notifications allow you to present to the user an alert box that has at most two buttons when your app isn't running in the foreground, one button for dismissing the alert and one button for taking the user to your app. In Apple's Clock app, however, it appears the user is presented with an alert box with two buttons, one button to dismiss the alarm and one button to "Snooze" and reschedule the alarm without launching the Clock app. My questions are...
When the user clicks the "Snooze" button, how do you think Apple is rescheduling the Local Notification for the alarm without launching the Clock app? Do you think they're using their own private APIs that circumvent the limitations of the Local Notifications that only allow for two options? Or do you think they're launching the Clock app to reschedule the Local Notification, they just don't show the app launching and quitting?
The documentation says the "alertAction" property of the Local Notification is the text to be displayed on the right button of the alert box and the slider bar of the lock screen. In Apple's Clock app, however, the "Snooze" text is the left button in the alert box, nor is it the Slider bar text. Why is this backwards?
Thanks so much in advance for your thoughts!
The local notification API does not have any mechanism to do what you want. The alarm clock app is almost certainly not using any of the infrastructure for local notifications, it predates them. Even if it is factored onto some of the infrastructure provided by local notifications, it is certainly not using the public APIs.
You should file a bug requesting that this functionality be added.

Resources