My boss wants to know if it's possible/feasible in iOS to write an app that will only use WiFi for connectivity.
This is definitely possible, but the mechanics can be tricky depending on the level you’re working at. Specifically:
For NSURLSession it’s very easy; when you create a session, clear
allowsCellularAccess
in the configuration you use to create the session and you’re good to go.For BSD Sockets it’s possible, although there’s some pitfalls. You can force a connection to run over a specific interface by binding to that interface (typically using
IP_BOUND_IF
). The problem is in identifying the Wi-Fi interface. There’s no guaranteed way to do that, although there are options that work reasonably well in practice (like CNCopySupportedInterfaces
).For APIs in between — things like CFSocketStream — the story is less clear.
I'm not at liberty to discuss why, but trust me, it's a serious and solid requirement.
This sounds like a security thing and, honestly, is a concern. If you want security, implement end-to-end security. Trying to implement security at the link layer is generally not a good idea.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"