【发布时间】:2017-01-18 11:09:30
【问题描述】:
我正在尝试从类方法访问实例方法。我收到此错误
+[ActiveVC goToDashBoard]:无法识别的选择器发送到类 0x112010
*** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“+ [ActiveVC goToDashBoard]: 无法识别的选择器发送到类 0x112010'
我的代码
+ (void) removeClosedVisitor:(NSString *) visitorID{
for (NSInteger i = activelist.count - 1; i >= 0 ; i--) {
ActiveItemObject *item = [activelist objectAtIndex:i];
if ([visitorID isEqualToString:item.VisitorId]) {
NSLog(@"Removing Visitor from Active List -- %@", visitorID);
[activelist removeObjectAtIndex:i];
//[self.incommingTable reloadData];
// NSDictionary *activeDictionary = [[NSDictionary alloc] init];
// activeDictionary = [activelist mutableCopy];
//
// [[NSNotificationCenter defaultCenter]
// postNotificationName:@"PassData"
// object:nil
// userInfo:activeDictionary];
[[self class] goToDashBoard];
}
}
}
- (void) goToDashBoard{
NSLog(@"Segue to Dashboard");
UITabBarController *dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"id_tabView"];
[dvc setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self presentViewController:dvc animated:YES completion:nil];
}
谁能帮我解决这个问题。 tnx。
【问题讨论】:
-
- (void) goToDashBoard是一个实例方法。如果要使其成为类方法,无需实例即可访问,请将签名更改为+ (void) goToDashBoard
标签: ios objective-c