在iOS上检测飞行模式 [英] Detect airplane mode on iOS

查看:202
本文介绍了在iOS上检测飞行模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检测手机是否处于飞行模式? (这不足以检测没有互联网连接,我必须能够区分这两种情况)

How can I detect if the phone is in airplane mode? (It's not enough to detect there is no internet connection, I have to be able to distinguish these 2 cases)

推荐答案

SCNetworkReachabilityGetFlags (SystemConfiguration框架)。如果返回的标志变量为0,返回值为YES,则飞行模式会打开。

Try using SCNetworkReachabilityGetFlags (SystemConfiguration framework). If the flags variable handed back is 0 and the return value is YES, airplane mode is turned on.

查看Apple的可达性类

这篇关于在iOS上检测飞行模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆