NSURLSessionConfiguration *cfg = [NSURLSessionConfiguration defaultSessionConfiguration];
cfg.allowsCellularAccess = YES;
cfg.multipathServiceType = NSURLSessionMultipathServiceTypeInteractive;
NSURLSession *session = [NSURLSession sessionWithConfiguration:cfg];
NSURL *url = [NSURL URLWithString:@"https://www.apple.com"];
[[session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *resp, NSError *err) {
if (err) {
NSLog(@"❌ Request failed: %@", err);
} else {
NSLog(@"✅ Received %lu bytes via %@",
(unsigned long)data.length,
resp.URL.absoluteString);
}
}] resume];
When I use NSURLSession and set multipathServiceType = NSURLSessionMultipathServiceTypeInteractive, whenever I’m connected to a Wi‑Fi network without Internet access, all of my app’s network requests automatically and seamlessly fall back to cellular to fetch data. Why, then, can’t WKWebView load pages? What do I need to configure?
Notes:
My developer account already has the Multipath entitlement.
I’ve added the Multipath capability under Signing & Capabilities in Xcode.
In my .entitlements file I’ve set com.apple.developer.networking.multipath = true.
Topic:
Community
SubTopic:
Apple Developers