Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

suhas verma

macrumors newbie
Original poster
Jul 3, 2016
2
0
texas
HI ,

Am trying to create an app which checks for any updates in websites which we already give in our which websites to check.could you please help me out how we can check whether there are any updates in a website(Like suppose we created a simple website which contains some text in it and once we check for frst time i go to that website and change some in that now in my code i need have a timer that checks for the updates for every 2 mins like that now as we chnaged some text it needs to show that it has been updated.Help me out how can i achieve this using swift xcode i tried create an tab based application.
Thanks.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
You can't distribute an app that does regular network transfers like that. It would use up battery like mad and Apple won't allow it. Users wouldn't like it either. Your app can make frequent transfers while it's running in the foreground, just not when it's in the background.

One way to approach this is with push notifications. Otherwise just make the checks when the app comes to the foreground and continue them while the app is in the foreground. If you want the user to know that something has updated when the app is in the background or not running then you should use push notifications.
 

suhas verma

macrumors newbie
Original poster
Jul 3, 2016
2
0
texas
Thanks for your Information.
I will try it using push notifications.But here when we visit a website we need to store that information right.in our code if we give fetch frequency of 2 mins then for every 2 mins it should go that website and check any changes r there r not.this operations should be performed on background when the app is running. Here do we need to deal with database for storing the web changes and checking whether changes are there?As i said its only a simple website with only text changes then is there anyway to get changes in website without using database r storing data? Thanks in Advance
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
If you want the app to be notified when it's running in the background the logic needs to be somewhere else, like on your server. Your app will register for push notifications when it's running in the foreground. Your server will determine if something has happened and then send the push notification. I don't know offhand how your server will determine if something interesting has happened.
 

iphonedude2008

macrumors 65816
Nov 7, 2009
1,134
449
Irvine, CA
If you are the site owner, doing this constant check for changes is unnecessary. Just have a text file on your server that lists the version, and every time you change the site, increment the version number. Then just have the app check the version and compare it to the version number it accessed previously.
 

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
Trying to do this from the app itself would be madness. You would want to detect these changes on a backend server.

It sounds like a pretty bad idea to me personally.
 

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
Not to argue the point, but a local push notification would allow for exactly this.
Not really....Apple will simply stop executing your app in the background after it's used up enough battery life.

This is one of the most basic examples of when you would use a backend web server to do something.
 

albebaubles

macrumors 6502a
Feb 9, 2010
625
547
Sierra in view
Really. Backend is preferred but what he wants and asked for definitely possible client side.

  • How the hell of you think pull email works, mr. superior?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.