Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在后台运行应用程序时检测Wi-Fi网络变化_Ios_Objective C_Iphone_Network Programming - Fatal编程技术网

Ios 在后台运行应用程序时检测Wi-Fi网络变化

Ios 在后台运行应用程序时检测Wi-Fi网络变化,ios,objective-c,iphone,network-programming,Ios,Objective C,Iphone,Network Programming,我发现自2011年以来没有答案,建议使用apple示例代码从iOS应用程序检测网络发生变化时(在后台运行时) 我需要能够这样做,而应用程序是在后台,但代码样本没有显示后台执行 你知道我该怎么做吗 这是我到目前为止编写的AppDelegate代码: #import "APLAppDelegate.h" //#import "Reachability.h" @implementation APLAppDelegate @synthesize reachability; - (BOOL)appli

我发现自2011年以来没有答案,建议使用apple示例代码从iOS应用程序检测网络发生变化时(在后台运行时)

我需要能够这样做,而应用程序是在后台,但代码样本没有显示后台执行

你知道我该怎么做吗

这是我到目前为止编写的AppDelegate代码:

#import "APLAppDelegate.h"
//#import "Reachability.h"

@implementation APLAppDelegate
@synthesize reachability;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Initialize Reachability


    //Reachability *

    reachability = [Reachability reachabilityForLocalWiFi];

    return YES;
}


- (void) applicationDidEnterBackground:(UIApplication *)application{
    // Start Monitoring
    [reachability startNotifier];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityDidChange:) name:kReachabilityChangedNotification object:nil];
}

- (void)reachabilityDidChange:(NSNotification *)notification {
    //Reachability *reachability = (Reachability *)[notification object];
    Reachability *reachability = (Reachability *)[notification object];

}

检查此项我以前使用过,但在后台检查时没有解释太多。@mm24您找到解决方案了吗?我正在使用NSURLSessionConfiguration Downloadtask,需要在后台出现网络断开连接时取消它。我需要在后台获得网络更改通知,因此我可以取消请求。检查此项我以前使用过它,但在后台检查此项时没有解释太多。@mm24您找到解决方案了吗?我正在使用NSURLSessionConfiguration Downloadtask,需要在后台出现网络断开连接时取消它。我需要在后台获得网络更改通知,因此我可以取消请求。