UIApplication有个属性networkActivityIndicatorVisible,用于在UI层面上表征网络正在进行,记下了。
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
example:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// To test, if Snapshot waits until the loading indicator is hidden
UIApplication *app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = NO;
});
return YES;
}