简体   繁体   中英

How to write text into the file saved on server in swift3 iOS

I am trying to write some text to the file on Server. Text file server path is:

http://test.info.com/log.txt

So, whatever we will write on this text file can able to see in browser. Please anyone suggest me.

In one word, There is no on the fly write possible from mobile to server file.

Justification:

Question:

What's happen if I paste the logfile URL( http://test.info.com/log.txt ) into the browser?

Answer:

It will just download the log.txt file. Also, It will not allow doing direct editing in the browser too. If it will is not feasible from the browser So how can we do it from the mobile end?

Alternatives:

Recently I worked with the same type of requirements. I have achieved it by creating the local log.txt file. Write into this file. Every day, I have uploaded the same log file into the server.

To write into the log file, I have used SwiftLog(Simple and easy logging in Swift)

You need to create 2 APIs on the server where your text file is kept. One API to get the data of the text file. Once that is done, show it in a TextView and edit it.

After editing, you can call another api to send the updated data back to the server.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM