Getting newest document from internet

user26830

I have a website with a domain and host where I have a '.txt' file that changes with the webpage's activity. I am trying to write a simple program in Objective-C that will read the 'txt' file and write all its content to an 'NSTextField'. Here is the code:

NSError *err = NULL;
NSString *str = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"theurl"] encoding:NSUTF8StringEncoding error:&err];
if(str != NULL)
    [_textField setString:str];

if(err != NULL)
    NSRunAlertPanel(@"An error has occurred while getting application data.", [err description], @"Ok", nil, nil);

The code works great except that it always gets the data in cache, meaning not the newest version of the file. Even when I'm not connected to internet, an error message doesn't pop up and I end up getting the string from the file. How can I make the program to go find the file on the net instead of the one from the cache?

I know that I can clear the browser cache but it's not a permanent solution, since I would have to clear the cache over and over again.

user26830

I have solved the problem by adding an .htaccess file to the root of my host. In the .htaccess, file I specified to not save any cached data from the site by the following code:

<IfModule mod_headers.c>
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</IfModule>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

getting the newest row inserted

From Dev

Lucene: get newest document for category

From Dev

Getting document from CouchDB with PhantomJS

From Dev

Getting the XPath from an HTML document

From Dev

MySQL grouping and getting newest rows

From Dev

Not getting the newest records with latest() in Laravel

From Dev

Getting internet connection status from WinRT

From Dev

Autostart and Getting data from internet in Background

From Dev

Getting a number of a text(?) document downloaded from server

From Dev

Getting an ArrayList from Firestore and the document name

From Dev

Getting null from document.getElementById().value

From Dev

XPages - getting a value from a profile document

From Dev

Getting xml document from url with ECDSA certificate

From Dev

Ajax/php getting newest data notification

From Dev

LINQ query for getting only newest items

From Dev

Jira Rest Api for getting newest ticket

From Dev

Gradle getting newest version for some libraries

From Dev

Extracting a specific area of an XML document downloaded from the internet

From Dev

How Does Microsoft Office knows if a document was downloaded from the internet?

From Dev

WPF - Getting Image Width/Height from internet URL

From Dev

Getting wrong results from json document in MongoDB c#

From Dev

emailBean from Tony McGuckin is not getting attachments after document is saved and reopened

From Dev

Getting several elements from XML document using Python lxml

From Dev

Getting document.getElementsByName from another page PHP/javascript

From Dev

Getting an empty list of services from a valid OWLS document

From Dev

emailBean from Tony McGuckin is not getting attachments after document is saved and reopened

From Dev

Getting variables from file and putting them in a HTML document

From Dev

Getting wrong results from json document in MongoDB c#

From Dev

Getting a list of items from document library using PowerShell in SharePoint

Related Related

  1. 1

    getting the newest row inserted

  2. 2

    Lucene: get newest document for category

  3. 3

    Getting document from CouchDB with PhantomJS

  4. 4

    Getting the XPath from an HTML document

  5. 5

    MySQL grouping and getting newest rows

  6. 6

    Not getting the newest records with latest() in Laravel

  7. 7

    Getting internet connection status from WinRT

  8. 8

    Autostart and Getting data from internet in Background

  9. 9

    Getting a number of a text(?) document downloaded from server

  10. 10

    Getting an ArrayList from Firestore and the document name

  11. 11

    Getting null from document.getElementById().value

  12. 12

    XPages - getting a value from a profile document

  13. 13

    Getting xml document from url with ECDSA certificate

  14. 14

    Ajax/php getting newest data notification

  15. 15

    LINQ query for getting only newest items

  16. 16

    Jira Rest Api for getting newest ticket

  17. 17

    Gradle getting newest version for some libraries

  18. 18

    Extracting a specific area of an XML document downloaded from the internet

  19. 19

    How Does Microsoft Office knows if a document was downloaded from the internet?

  20. 20

    WPF - Getting Image Width/Height from internet URL

  21. 21

    Getting wrong results from json document in MongoDB c#

  22. 22

    emailBean from Tony McGuckin is not getting attachments after document is saved and reopened

  23. 23

    Getting several elements from XML document using Python lxml

  24. 24

    Getting document.getElementsByName from another page PHP/javascript

  25. 25

    Getting an empty list of services from a valid OWLS document

  26. 26

    emailBean from Tony McGuckin is not getting attachments after document is saved and reopened

  27. 27

    Getting variables from file and putting them in a HTML document

  28. 28

    Getting wrong results from json document in MongoDB c#

  29. 29

    Getting a list of items from document library using PowerShell in SharePoint

HotTag

Archive