How can I edit /etc/hosts on my iOS device? I just do sudo nano /etc/hosts on OS X. Perhaps writing a small app to do it is the best way.
Note that I just want to edit it on my iOS device. I’m not planning on editing it for apps in the app store.
You can’t edit any files outside of your application’s sandbox (without jail breaking). See this question (Is it possible to access iPhone/iPad app files without jailbreak?) for more information on viewing files in your app’s sandbox. If you jailbreak your iPhone, you can access /etc/hosts in numerous ways:
cdcommandI just found a way of accessing your files without jail breaking, but I have not tried it. There’s an application called iFunbox that claims to allow the user to access an iPhone’s root filesystem without jail breaking. Once again, I have not tried it and do not know if it works but you might want to check it out. You can download it here http://www.i-funbox.com/.
Hope this helps!