-1

Hi i want to make an IOS app that shows tips regularly, probably pulling these tips from a blog or website of my own so that the content can be updated instantly within the app. I am hoping that there is a way of sending a local notification saying for example "You have a new tip!" after ive input some text into the blog/website that is linked to the app while its in the background? Or can i only use push for this?

thanks!

2 Answers2

2

If you want your push notification to be linked to the addition of new content, I would suggest implementing remote push notifications.

If this is not an option, you can always fire a UILocalNotificationat a certain interval. This does not need particular setup in your app, nor an external server. You just have to create it, set a fire date, schedule it and wait for the notification to pop. The only problems are, the apps needs to run (the notification won't fire if the user kills the app), and will trigger at a certain time, not a certain context (i.e. added new tip).

Little clarification

You could use background fetch to get data from the server, but this can cause you trouble. The thing you need to consider is the refresh rate : if you put it too often, your server will get overwhelmed with requests. Imagine if all your user ask informations to your server every hours, without exception... that can cause your serveur to crash under too high demand.

What you could do if you already know when a certain content will be added, is fetch information from the server once a day or once a week, and schedule your local notifications to fire on that day, at the wanted hour. The problem is, if the content is removed or added and your app doesn't update, the user could receive wrong information. Remote push notification is still the safest way.

Emilie
  • 2,413
  • 13
  • 12
  • Hi, thanks. The notifications cannot be scheduled, i didnt want to give away what the app is (although you can probably guess!) but tips will be decided at the time of writing it which could be anytime and the users will want to see them right away. Ideally i didnt want to use push as from what i read they can be a delay, but are you saying other than scheduled local notifications, theres no way of using them for when new content arrives? – David 'Budge' Goodger Jan 28 '15 at 18:16
  • To let your user know that there is new content, your app needs to know that there is new content. Remote push notification was made for that. Yes, it can be delayed, and could even be lost (if the user's phone is turned off, for example), but this is the simplest and more efficient way. I added a little clarification on how you can still use background fetch to help you, but I still think that remote notif would still be the best way. – Emilie Jan 28 '15 at 18:38
  • The tips will only be relevant for 90 mins so i guess if the user has their phone off it wont matter anyway. Ive looked into Parse so i guess thats the way to go. Thanks! – David 'Budge' Goodger Jan 28 '15 at 18:57
0

Yes you can.

You will need to get from your server the required updates on background and fire local notifications from this data.

In this post you can see how to use background fetch to get new info, you will need every time you get new info place a local notification. http://www.appcoda.com/ios7-background-fetch-programming/

dminones
  • 2,236
  • 20
  • 21