0
幫助newby!我的應用程序有3個視圖控制器。 VC#3(*贊助商)將用戶帶到我的網站&,所以我試圖爲此VC實現可達性。我添加了系統配置框架& Apples Reachability .H & .M文件到項目。禁用ARC for Reachability .M文件& VC#3 .M文件。該項目B & R好,但我仍然沒有得到彈出警報時斷開互聯網。我也將Reachability.h導入VC#3。我錯過了什麼?請幫忙。Xcode:使用故事板的附加視圖控制器上的可達性
VC#3(*贊助商).M
`
#import "Sponsor.h"
#import "ViewController.h"
@interface Sponsor()
@end
@implementation Sponsor
-(void)viewDidLoad {
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL
URLWithString:@"http://opticertificationprep.webs.com/"]]];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
-(IBAction)home:(id)sender{
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (BOOL) hasInternet {
Reachability *reach = [Reachability
reachabilityWithHostName:@"www.opticertificationprep.webs.com"];
NetworkStatus internetStats = [reach currentReachabilityStatus];
if (internetStats == NotReachable) {
UIAlertView *alertOne = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Check Your Internet Connection" delegate:self cancelButtonTitle:@"Okay"
otherButtonTitles:nil];
[alertOne show];
[alertOne release];
}
return YES;
}
`