I'm trying to send a Push Notification at a time, let's say 9:00 a.m. Also, what is the best way to do this, Objective C or Swift? I am relatively new to both languages so it doesn't really matter.
Related
I'm new to coding and was wondering if anyone had experience with sending out a randomly picked push notification from a list, database, array or whatever with the user being able to control at which time they will receive it. I would preferably automate the process. Thanks for your time and help. I´m currently creating the app for IOS with Swift.
This could be done with UserNotifications in Swift, where the user could set a specific date and time, and then using that for the scheduled notification. I haven't done this before, but this is how I would imagine it's done.
I am trying to work out the best way to use local notification in background to run a method to display a notification message from core data, based on due date or upcoming weekly and monthly summary report.
There are two options which I have worked out which is NSTimer and UILocalNotification.
With NSTimer i can run scheduledTimerWithTimeInterval every 24 hours in background to check core data before display local Notification to see if it is on due date, weekly or monthly report. I am not sure if this is best solutions or recommendation?
I have read other posts, they suggestion to use UILocalNotification instead. But they are only limited to 64 notifications per app. Thats ok if I use weekly and monthly which total 64 notifications but it won't work after 1 year unless user active the app also I need to display due date's on the day message as well.
I am thinking maybe after a local notification displayed then the app still in background set new next schedule local notification, but I couldn't work this one out so not sure if this is possible?
Any suggestions on this? Thank you in advance.
I'm building a reminders app, and been really interested in how to set a reminder to repeat itself every day/every month/every hour.
Basically I want to set something to repeat, even when my app is not running. In my case a local notification fire.
Thanks!
You can set the repeat interval easily using NSCalendarUnits
notification.repeatInterval= NSDayCalendarUnit;
For more calendar units check constants on http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/Reference/NSCalendar.html#//apple_ref/doc/c_ref/NSCalendarUnit
You have to use Local Push Notifications, because when your App is running in background this is the only way Apple would allow you to do something:
Check this for further info: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008194-CH1-SW1
And this is a good tutorial about it: http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/
Check out Apple's reference documents here on using UILocalNotifications. I believe that is what you're looking for.
You can utilize UILocalNotifications to show a local notification at a certain time or date, whenever you like.
David Linsin also has a good post on this here.
Good Luck!
Sometimes, when the app I'm working on comes out of suspended mode, I need to make sure it does not respond to the notifications iOS has saved for it while the app was suspended. Where's the right place to perform this cancellation where I can be sure my response code won't run?
I'm hoping that putting removeObserver is applicationWillEnterForeground would do the trick, but I couldn't find anything about this in the NSNotification doc.
Edit:
Let me add the details of the scenario:
The app I'm working on checks for changes to calendar events for the range of the next 7 days. It refreshes it's data (requeries eventStore) at two times:
1. When an NSNotification comes from the iPhone calendar about changes.
2. The first time the app is able to on a new day, because the 7 day range has changed.
The design challenge I'm having is the case where both scenarios are true at the same time (the app returns from being suspended and it's a new day, and calendar events were modified while the app was suspended ). I only want to requery the event store one time in that case. My thought is to, in applicationWillEnterForeground, on the case that it's the first launch of the day, tell the app to ignore or drop any notifications.
I'm getting the impression my assumptions about how NSNotifications would work in this case might be off. Any guidance would be great!
Why not remove the observer from the notification centre in -applicationDidEnterBackground:?
Then you can start observing again in -applicationWillEnterForeground:.
What NSNotifications come in while you’re suspended? Are you running a background task?
I can’t really think of a case where not responding to an NSNotification would be a good idea. They are effectively messages like any other, just with a different routing mechanism.
UILocalNotification would be a different issue.
I want to build an iPhone app - the entire purpose of which is to send push notifications.
In this case it'd send one quote from a famous person a day. The interface would just be a preference screen where you can control what time of day you'd like the notification to be sent, so it's pretty bare bones.
I don't really have the development chops to write it from scratch so I was wondering if there's an ideal platform, app-builder, or whatever to create it with.
You might want to try www.elance.com
The application itself will be easy to implement. But the other part is the Pushing application which will be sending the messages.
Check this tutorial here, Programming Push Notification Service
You might not necessarily need push notifications; if your quotations can be stored on the device, you can show them using local notifications instead.