Let's say I have an html file on my server called sample.txt (it's a plain text document)
Inside the sample.txt file is a line that says http://sample.com
In my app's delegate I have this code
NSDictionary* defaults = @{@"server_addr": @"http://sample.com"}; [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
Instead of having to change the server_addr
within the app when needing to change servers, I'd like to change the server_addr
from outside the app by calling whatever line of code is in sample.txt on my server.
How can I do this?
Any help would be greatly appreciated!
You can use NSURLSessionDownloadTask
to download file from server.
Or if You want to check version data of server You can get even "Last-Modified"
field from HTTP response header, and compare with current data version in your app.
Read the downloaded file to get what data that You want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.