iOS App for change detector in websites

Discussion in 'iOS Programming' started by suhas verma, Jul 3, 2016.

  1. suhas verma macrumors newbie

    suhas verma

    Joined:
    Jul 3, 2016
    Location:
    texas
    #1
    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.
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    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.
     
  3. suhas verma thread starter macrumors newbie

    suhas verma

    Joined:
    Jul 3, 2016
    Location:
    texas
    #3
    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
     
  4. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    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.
     
  5. iphonedude2008 macrumors 65816

    iphonedude2008

    Joined:
    Nov 7, 2009
    Location:
    Irvine, CA
    #5
    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.
     
  6. albebaubles macrumors regular

    albebaubles

    Joined:
    Feb 9, 2010
    Location:
    Desert Southwest
    #6
    Send the updates in the push notification payload. app can upload in the background and nobody's the wiser.
     
  7. AxoNeuron macrumors 65816

    AxoNeuron

    Joined:
    Apr 22, 2012
    Location:
    The Left Coast
    #7
    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.
     
  8. albebaubles macrumors regular

    albebaubles

    Joined:
    Feb 9, 2010
    Location:
    Desert Southwest
    #8
    Nothing wrong with polling from the client side if you're aware of the tradeoffs.
     
  9. AxoNeuron macrumors 65816

    AxoNeuron

    Joined:
    Apr 22, 2012
    Location:
    The Left Coast
    #9
    In his case though, it is indeed a bad idea, since his idea revolves around polling when the app is NOT open.

    This should absolutely be done on a backend server.
     
  10. albebaubles macrumors regular

    albebaubles

    Joined:
    Feb 9, 2010
    Location:
    Desert Southwest
    #10
    Not to argue the point, but a local push notification would allow for exactly this.
     
  11. AxoNeuron macrumors 65816

    AxoNeuron

    Joined:
    Apr 22, 2012
    Location:
    The Left Coast
    #11
    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.
     
  12. albebaubles macrumors regular

    albebaubles

    Joined:
    Feb 9, 2010
    Location:
    Desert Southwest
    #12
    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?
     
  13. AxoNeuron macrumors 65816

    AxoNeuron

    Joined:
    Apr 22, 2012
    Location:
    The Left Coast
    #13
    Speaking from experience....? Poorly.
     

Share This Page