此API控制器使用GitHub的系统状态API,并返回当前状态
KSGithubStatusAPI *statusAPI = [[KSGithubStatusAPI alloc] init];
[statusAPI checkStatus:^(KSGithubStatus *status) {
if (status.isAvailable) {
NSLog(@"Github is available");
} else {
NSLog(@"Github isn't available");
}
NSLog(@"Status: %@", status.status);
NSLog(@"Details: %@", status.details);
NSLog(@"Last Checked: %@", status.readableCreatedAtDate);
NSLog(@"Last Checked: %@", statusAPI.readableLastCheckedDate);
NSLog(@"Github updated date: %@", status.readableGithubUpdatedDate);
}];
使用CocoaPods,在Podfile中
pod 'KSGithubStatusAPI', '~> 0.2.0'
将Reachability添加到您的项目中。将所有的.h
和.m
文件添加到您的项目中。