如何检查iPhone应用程序中的网络类型

如何检查iPhone应用程序中的网络类型

问题描述:

上周我们将应用程序提交给了苹果。昨天我们收到了他们的回复。基本上我们的应用程序播放IIS中的视频。现在我们根本没有检查网络类型。它也播放没有Wi-Fi的视频。但苹果要求我们限制它只与wi-fi一起玩。所以现在我需要检查我的网络连接类型。

Last week we submitted our app to apple. Yesterday we got response from them. Basically our app plays the videos from IIS. Now we are not at all checking the network type. it is playing videos without wi-fi also. But apple is asking us to restrict it to play only with wi-fi. So now i need to check my network connection type.

可以发布一些代码或任何现有的库来执行此功能。

can some on post the code or any existing libraries to do this functionality.

非常感谢..

您可以使用:

SCNetworkReachabilityFlags flags;
SCNetworkReachabilityGetFlags (target,&flags)
);

if (flag & kSCNetworkReachabilityFlagsIsWWAN)
  // 3G/Edge/GPRS
else
  // Wifi