iPhone app sharing data over both Wifi networks - iphone

I need to make an iPhone application which connects to a first Wifi network, receives some files from a specific device and then sends these files to a computer being connected on another Wifi network.
I see two possible approaches :
1. to send the files to the computer, my app disconnects from the first Wifi network and connects again to the second network
2. my iPhone app is able to connect itself to two different Wifi networks.
I believe the second solution above is not possible on iOS and the first one needs to use private APIs.
Do you see for other solutions for me to receive data from a device connected to a Wifi network and then send data to another device connected to another Wifi network ?
Thank you very much for your help.

You cannot programmatically modify the selected WiFi on iOS without using private API. I think this post describes what you want.
I think it is very unlikely for Apple to change this, therefor I suggest using a web service to upload the data to and a push notification to the computer to tell it to download the data once it has finished uploading.

Related

How to detect all available Wifi networks and connect to one of them in an iOS app

In my iOS app, I want to detect all available wifi networks and then choose one network form the list and connect to it. The goal is to not open the Settings built in app to connect to a wifi, but to do it all in my app.
First, is this possible? If possible, please point me to what framework(s) and methods to use.
I have looked at the Reachability example, but that doesn't work for me because, I think, all it does is monitor the network state of the device.
I also looked at the Captive Network Support framework, and used the CNCopySupportedInterfaces function:
CFArrayRef allWifiNetworks = CNCopySupportedInterfaces();
NSLog(#"%#", allWifiNetworks);
but all I am seeing is the current wifi network that the device is connected to.
Thanks
I'm pretty sure you can't do this, at least not if you want to be able to publish on the App Store.

iPhone: connecting to multiple networks

I'm currently working on a project that requires the iPhone to connect to another device using an Ad-Hoc network (WiFi). Simultaneously, I require a connection to the internet in order to upload data to a server also using WiFi.
My question is: is the iPhone capable of connecting to multiple networks?
If not, is it possible (and viable) to switch between networks assuming the data rate is low? For example, iPhone receives data via Ad-Hoc, disconnects, connects to other WiFi network, established connection with server, sends data, disconnects from network, reconnects to Ad-Hoc network etc?
If the data rate is low and you are talking to another iOS device, check out GameKit.
This is Bluetooth, though.
I have not seen a way to connect to multiple wi-fi networks simultaneously.

Communication between iOS app in one Wi-Fi network w/o server

I need to communicate my app with 2 devices. A restriction is that I can't use a server but all iOS devices will be in one Wi-Fi network. What options do I have? How I can send a message to another copy of my app running on another device?
I dont know whether its a correct approach or not but as you cannot use server,so the approach i can think of is we can create a socket connection using TCP/IP or UDP(based on reliability) for data exchange.
I dont think you can communicate between 2 devices running the same application without having some kind of server application in-between.
Even if you could find the other device over the WIFI I dont think you can tell if the other device is running the app or not.
I think you may be referring to MultipeerConnectivity
The Multipeer Connectivity framework provides support for discovering
services provided by nearby iOS devices using infrastructure Wi-Fi
networks, peer-to-peer Wi-Fi, and Bluetooth personal area networks and
subsequently communicating with those services by sending
message-based data, streaming data, and resources (such as files).
Source: https://developer.apple.com/library/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/
Apple Sample:
https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Introduction/Intro.html

use 3g for internet when connected to adhoc wifi (using private API's)

First and foremost,
I am looking for a resource to use Private API's.
this is an enterprise application and will never go to the app store
I need to take as much configuration out of the users hands as possible.
That being said, I have a device that an ipad will be connected to and communicate with via an adhoc wifi network supplied by the device. the ipad connects to this device and sends raw data to it via socket connections. I also need to connect to the internet for data syncing.
80% of the time, the ipad will be connected to this adhoc wifi device. Management software on the ipad does not allow the user to adjust wifi settings so I am trying to make sure I am connected to my device without limiting my server syncing. I know I can determine the connection using apples Reachability class, this is not what i am looking for. I need to use BOTH 3g AND wifi.
Is there a way to enforce this in code? Or is there a resource for the private API's that I can look at to find a way?
This will be in iOS 5 and the most preferable method would be to just route my http requests via some private api method to use 3G and let the socket requests use wifi to the adhoc device.
code samples would be awesome, links / class names to research would be very much appreciated.
and once again this is not going into the app store, it is an enterprise app
the resolution i found was to assign an ip in the privately assigned ip range the ipad uses (169.254.x.x) to the adhoc device then let the ipad determine an ip. Then see if i can open a socket connection to the device (to determine if its available) and then issue a print.
Going this route, i am still able to use 3g data as well as communicate with the device via wifi.

iPhone as proxy for data upload

I want to create an iPhone application that can call web services on a computer, and then upload those files over the iPhone 3g connection. Is there an elegant way to do this?
I tried connecting the phone to local Wifi, but connecting to Wifi disables 3g, even though the Wifi is local network only.
I assume the same problem would arise if I could network the phone with the computer via bluetooth.
Any other ideas? The purpose is to go up to a special demo PC we created, pull some data off, then upload to the Internet, all within proximity of the machine. Unfortunately, it appears that I can't use one connection for pulling data, and another for pushing.
Your assumption is correct. When connecting to both 3G and Wifi, the Wifi connection will be used. Sounds like your local network has no route to the Internet. Perhaps that could be fixed.
Apple does not prefer its iPhones to be used as routers.
If you're working on something that will not be distributed through the App Store, you may have some success looking at "tethering" applications and their source code, which can be found by some clever Googling.