iOS Open WI-FI Networks Controller - iphone

I show a pop-up when no connection is available. When pressing on OK button of this pop-up I would like to open WI-FI Networks native Controller (Settings). How can I do that?
Thx!

On a non-jailbroken device, I do not believe that this is possible because you cannot open another application or execute any code that is not part of your application. If your application requires that the user be connected to WiFi, you can set the UIRequiresPersistentWiFi key in your Info.plist. This will leave it up to iOS to present the user with anything required to connect to a WiFi network.

Related

How to pop-up the "Cellular data is Turned Off" warning message?

Apple's built-in applications show a pop-up message whenever the user doesn't have cellular or wifi connectivity. It looks something like:
"Cellular data is Turned Off
Turn on cellular data or use Wi-Fi to access data
[Settings] [OK]"
Clicking on the Settings button opens the settings panel.
Is this a system pop-up? How can I use it in my own application?
I'm already using UIRequiresPersistentWiFi but it uses a different type of message which appears when airplane mode is on.
Thanks!
You need to enable Application uses Wi-Fi in info.plist. Then this warning is displayed when cellular data is turned off and you're not connected to wi-fi.
Look at the Reachability example in Apple's Sample code. It will give you all the code you need to determine if you're connected or not to the internet.

How to launch an iphone app when an external accessory is either paired over BT or plugged into dock connector

I have researched this to death online and cannot find anything regarding auto launching an iphone app when an external accessory is either paired using BT or plugged into the dock connector.
We are an MFi developer with a BT accessory and application that we would like to launch when paired. We have the Info.plist containing our protocols and the device containing the correct protocol all working and communicating. The application works well with our BT device, however I would like to see the app launch when paired.
I have seen this before with accessories plugged into the connector and would live to know how that is accomplished.
http://www.metacafe.com/watch/5772611/ces_2011_withings/
Check at 3:15 in the video.
Does iPhone just have that ability for dock connected items to auto start?
I know that the External Accessory framework registers the protocol with the iPhone when the app is installed. This is how the iPhone/iPod knows to take you to the apple store when you connect a BT (or connector) device and you don't have an app for your connected devices protocol.
I don't understand why the app does not launch when paired, I would think this would be a no brainer. Can someone please shed some light on this topic. The best I found is from Apples docs:
Applications that are able to communicate with an external accessory should declare the ?protocols they support in their Info.plist file. Declaring support for specific protocols lets the system know that your application can be launched when that accessory is connected. If no application supports the connected accessory, the system may choose to launch the App Store and point out applications that do."
I cannot understand the meaning by "may choose to launch", does this mean is also chooses to launch? Please help.
The manufacturer of the device needs to include support for this feature at the firmware level. The details of this process are currently confidential by way of the MFi (Made For iPhone/iPod) non disclosure agreement, so unfortunately that is all the detail I can provide. Good luck!

How to change connection from 3G to wi-fi programmatically using iPhone SDK?

Lets consider that I am connected to internet through 3G in my App. When a wi-fi hot spot seems to be appearing, can I programmatically switch to the wi-fi. Is this vice-versa condition possible?
iOS does this automatically by itself!
If no known WiFi network is found, it uses cellular data. If it finds a known WiFi-network, it connects to and uses that network instead.
If any WiFi-network is found, and your application requests access to the internet, iOS (usually) automatically presents an alertView and lets the user log in to a WiFi-network. If the user does not log into a WiFi-network, it stays on the 3G-network. When iOS 7 comes, iOS may connect to Hotspot 2.0 networks automatically as well.
Apple keeps individual apps on a tight leash, and so they do not let apps control things like this.

Restrict iPhone app to Wifi

Is it possible to restrict an iPhone app to only work if there's a Wifi connection (not 3G)?
Yes. There are two steps:
First, you need to add the UIRequiresPersistentWiFi key to your applications Info.plist. This ensures that the WiFi connection does not go to sleep while your application is open.
Secondly, you need to query the system (using the SCNetworkReachability API) to see which radio is currently enabled. See this question in the iPhone documentation.
You can also get the Reachability class from Reachability sample from apple dev center. It offers a way to check how the iphone is connected.
Networking and Internet how-to's
If your application requires WiFi,
you need to add the
UIRequiresPersistentWiFi key to
Info.plist and set it True. This key
notifies the system that your
application uses the WiFi network for
communication.

How to display a list of Wifi-Networks in an iPhone app?

I found some private (undocumented) APIs but Apple does not allow apps to use private frameworks. So does anyone know how to do this using Apple official packages?
like: when youtube app prompts you to the push notification: "Select a Wi-fi network"
Thanks in advance.
If you set the UIRequiresPersistentWiFi setting in your info.plist file, the iPhone OS will know that your app needs Wifi and pop up the message for you.
As far as I know, no app actually manually displays the wifi selection alert.
Thats wrong check this app out
http://itunes.apple.com/us/app/ihome-connect-setup-app-for/id450241802?mt=8
It shows available wifi networks
The best you can do in iOS, currently, is display the network the user is currently connected to. iOS doesn't allow you to access a wifi scan from within an app. I've been wrestling with this inability for some time now.
If designing an accessory that has WiFi, where you're trying to pass the user's WiFi network SSID and password, it will be up to the accessory to give the app that wifi scan list. The app can then display the list the accessory gave it to the user.
(I bet that's how the app #zaid pointed out in his answer, "iHome Connect", is doing it.)
Another approach is you could have a screen that prompts the user to enter the password to the wifi network they're connected to already, and then once the accessory is connected to the app, pass those details without the need for a wifi network list. I think that approach has a better user experience.
Plenty of stackoverflow questions that answer how to get the current wifi network, here's a couple:
Getting OSX Connected Wi-Fi Network Name
How do I get the current wifi network name after Yosemite in Swift?