Can my iPhone app host a Local Web server and allow other apps to the phone to access the LWS? - iphone

I will use one of the following cocoahttpserver or iPhoneHTTPServer3, SimpleWebSocketServer, MultithreadedHTTPServer3 to host a server in my app.
Iam aware that a built-in apache is not possible..
Can other apps in the phone make http request to this server hosted locally.
Thanks,
--srihari

Yes, it can be done in a wired way. Cause apple doesn't allow app runing in background offically, however there's one exception that playing music in background is allowed, so you can keep your app running in background with playing a mp3 infinitely. However this is only a workaround, it would consume all your battery quickly.

Related

WatchOS establish server connection

I have a client - server IOS application. In addition, I need to write an application for it on WatchOS. So I have 2 questions:
When I send a command from Apple Watch, do I need to connect to the server from the watch or transfer information to the IOS application and connect to the server from the phone?
If I have to connect to the server with an IOS application, then how can I connect in background mode?
As an example, you can take any messenger, for example Telegram
If I reply to a message with AppleWatch, how is the message being sent to the server (Via iPhone or directly via AppleWatch)
For connection to the server, I use the "Starscream" framework
Maybe I don't understand something, but Apple made it impossible to establish a connection in background mode
I would be grateful if you tell me or provide examples and articles, so that I could understand what to do.
Apple Watch apps can connect directly to servers using URLSession ... no need to go via the phone.
Here is an example on using URLSession in Combine, which is the "latest and greatest" way of doing things.
Otherwise this example shows using it in a more conventional way, with the bonus of SwiftUI.
Otherwise

How can I test an iOS App I am creating and simulate a Chinese user?

I am developing an app that will be used world-wide and have a co-worker who lives in China. He claims it takes a very long time to reach our server here in the US and I want to be able to use the app on my phone but through a VPN and proxy on my iPhone so it appears that I am in China. Is that possible?
Here you can find a list of Chinese web proxies.
You should also change your app so that it goes to through the proxy. This depends on how you are dealing with HTTP communication but if you google it, you will find many posts.
Keep in mind that a proxy will add a further delay in communication.
If you want to setup a VPN, have a look at this tutorial for setting up a VPN on your Mac and then connect the iPhone to it.

Prevent from specific app using internet connection

I have a client claims that my app can't connect to internet despite of he has WiFi connection and Safari application, for example, works fine. Is there any way to setup for specific app NOT to connect to the internet? I use in my app simple ASIHTTTPRequest library to make a connections. Maybe it influenced by jailbroken device? Regards!
No, there is no way to do this in via an iOS setting.
However I've had a problem like this with a client, where to Webservice the app connecting to was blocked by there firewall/proxy.
Later the black was lifted but all calls to the webservice where is cached by the proxy give really weird results.

iPhone - Browsing iPhone files through computer

I want to be able to send files from an iPhone app to a computer. What would be the easiest way of doing this?
I've made simple server client programs before, but in those, the client has always needed to connect to the server before being able to receive messages from it. There is an app for the iPhone called iSimulate, where you put a server on a Mac (the iPhone simulator), and then you use the iSimulate app of an iTouch or iPhone to send touch events to the server. This app does not require you to type in an ip-address. Instead it presents a list of available computers that have this server up and running.
How exactly is this being done? Can a server broadcast a message over a network, w/o anyone being connected to the server? How does that work? How does a client listen for that broadcast?
Here's a video of the app I'm talking about:
http://www.youtube.com/watch?v=N3Qpd1ycZh4
alt text http://a1.phobos.apple.com/us/r1000/051/Purple/7b/07/70/mzl.mvwjifyc.320x480-75.jpg
That app may be using Bonjour.
I've seen similar apps use a peer-to-peer Bluetooth connection to exchange files between a iPhone and a desktop.

How do I write a desktop application that syncs with the iPhone?

For example, how would I write a program like senuti? Are there any libraries I can use for this? It would be ideal if I could do this in Python or .Net, but I'm open to other things as well.
There are three things you can do:
Add some code to your iPhone application which acts as some kind of server (http, SMB, etc). Then your mac/windows full client application can connect to this server over wifi. This is safe and reliable, but unfortunately the app will have to be running on the iPhone at the time of sync.
Sync to the "cloud". EG: Have your iPhone app save some data to a web server on the internet (you could use amazon EC2, windows Azure, or even just a PHP script running on a cheap hosting account), and then have your windows/mac client also connect to this web server to retrieve the data. This is the most user-friendly, but it requires you to pay for the hosting of the web server, and will be unsuitable for large amounts of data
Violate the EULA and try to reverse engineer the way iTunes communicates with the iPhone.
This is how senuti works, but I wouldn't recommend it, as they're constantly having to play catchup with apple changing the format underneath them, and they are probably exposed to some kind of legal action, if apple ever bothered to sue them.
i believe Version 3.0 will resolve this as it allows you to program apps to the USB interface. check out some of the documentation for that in the External Accessory framework.
it would still require the app to be open, so essentially would mean two syncs (or more if you have multiple apps)
There is no legal / official way of doing this. Creating a program that would sync with an iPhone would violate the EULA you agree to when using the iPhone and iTunes.
Not only is it illegal, but it's also impossible to do this reliably. Apple could break the method at any time without any notice, and it would pretty much be a cat-and-mouse game.
I only know of one application that something of the kind, and it is the iToner application which synchronizes ringtones.