[英]Error message Use of undeclared identifier
This is the code above: 这是上面的代码:
- (void)viewDidLoad {
[super viewDidLoad];
[self showLoginProcess:false];
#ifdef DEBUG
self.usernameBox.text = @"passenger@test.com";
self.passwordBox.text = @"123456";
NSLog(@"baseUrl = %@", kBaseURL);
#endif
//TODO: check if internet is available
(void)testInternetConnection
{
internetReachableFoo = [Reachability reachabilityWithHostname:@"www.google.com"];
// Internet is reachable
internetReachableFoo.reachableBlock = ^(Reachability*reach)
{
// Update the UI on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"There is an internet connection");
});
};
The first line -(void)testInternetConnection gives me an error message which says: Use of undeclared identifier 'testInternetConnection' 第一行-(void)testInternetConnection给我一条错误消息,内容为:使用未声明的标识符'testInternetConnection'
Thanks. 谢谢。
Check brackets , semi colons above this method. 在此方法上方检查方括号,半冒号。
There is problem in line above this function. 此功能上方有问题。 select this function and Cut 选择此功能并剪切
(CMD + X)
then check the error in above line. 然后检查以上行中的错误。
Add function in header (.h) file as - (void)testInternetConnection;
将标头(.h)文件中的功能添加为- (void)testInternetConnection;
You are missing class type before the var. 您缺少var之前的类类型。 Try adding: 尝试添加:
Reachability* internetReachableFoo = [Reachability reachabilityWit .... , as below 可达性* internetReachableFoo = [可达可达性Wit ....,如下
- (void)testInternetConnection
{
Reachability* internetReachableFoo = [Reachability reachabilityWithHostname:@"www.google.com"];
// Internet is reachable
internetReachableFoo.reachableBlock = ^(Reachability*reach)
{
// Update the UI on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"There is an internet connection");
});
};
-(void)testInternetConnection
{
internetReachableFoo = [Reachability reachabilityWithHostname:@"www.google.com"];
// Internet is reachable
internetReachableFoo.reachableBlock = ^(Reachability*reach)
{
// Update the UI on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"There is an internet connection");
});
};
} // You may be missed your closing bracket
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.