我希望在IOS中完成应用。当网络丢失时,应用程序必须向用户发出通知。是否可以使用Objective C检查网络状态?这是很多工作吗?
我是ios开发的新手,编码的人说这需要几个小时才能完成。
我还想要ios的vcard共享脚本。开发人员表示完成任务需要5天时间。
任何人都能帮助我吗?我厌倦了听到他身边的许多借口,无法继续前进。
谢谢
答案 0 :(得分:1)
If you want to check reachability before some code execution you should just use..You can use reachability class for checking network status..
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus internetStatus = [reachability currentReachabilityStatus];
if (internetStatus != NotReachable) {
//my web-dependent code
}
else {
//there-is-no-connection warning
}
You can also add a reachability observer somewhere (i.e. in viewDidLoad):
Reachability *reachabilityInfo;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(myReachabilityDidChangedMethod)
name:kReachabilityChangedNotification
object:reachabilityInfo];