如何檢查應用程序是否連接到互聯網? 目前,我在我的appdelegate.m
文件如何檢查ios中的互聯網連接?
dispatch_queue_t connectivityThread = dispatch_queue_create("com.gm.kart.connectivity", NULL);
dispatch_async(connectivityThread, ^{
while (true){
if([GMMConnectivity hasConnectivity])
NSLog(@"%@", @"connected");
else
NSLog(@"Not connected");
usleep(10000000);
}
});
使用此代碼,當我點擊我的登錄按鈕,我想要做一個上網一查是否連接不使用NSnotificationcenter
?
請幫我
你搜索某些內容? http://www.google.com/#output=search&sclient=psy-ab&q=How+to+check+internet+connectivity+in+ios%3F&oq=How+to+check+internet+connectivity+in+ios%3F&gs_l = hp.3..0i22i30l2.950.950.0.1947.1.1.0.0.0.0.173.173.0j1.1.0 ... 0.0 ... 1c.1.9.psy-ab.FQR8PLKiNzs&PBX = 1&BAV = on.2,or.r_qf。 &bvm = bv.45368065,d.bmk&fp = 55f9ca2dd31d2c85&biw = 1600&bih = 799 – Buntylm
tried..but與我的代碼沒有任何關係 – Naveen
我不知道GMMConnectivity,但這裏是您如何使用Reachability(Apple提供的類)和NSNotificationCenter :http://stackoverflow.com/a/15854823/412916 – Jano