Mic*_*hKE 11 iphone objective-c ios uistoryboardsegue swift
我有一个导航控制器,它们之间有一个名为"addSegue"的segue链接.当我点击tableView
单元格虽然应用程序崩溃,我得到以下错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<MSAddFriendsViewController: 0x98cc340>) has no segue with identifier 'addSegue'
Run Code Online (Sandbox Code Playgroud)
我认为我的代码没有任何问题.这是我有这条线的方法showSegueWithIdentifier
:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSMutableSet *selectedUsers = [NSMutableSet set];
[self.tableView deselectRowAtIndexPath:indexPath animated:NO];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
PFRelation *friendsRelation = [self.currentUser relationforKey:@"friendsRelation"];
PFUser *user = [self.allUsers objectAtIndex:indexPath.row];
[friendsRelation addObject:user];
[self.currentUser saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (error) {
NSLog(@"Error %@ %@", error, [error userInfo]);
} }];
[self performSegueWithIdentifier:@"addSegue" sender:self];
}
Run Code Online (Sandbox Code Playgroud)
oox*_*xio 16
我有同样的问题,实际上我的问题是我在打电话
WRONG: [self.navigationController performSegueWithIdentifier:@"ShowVerify" sender:self];
Run Code Online (Sandbox Code Playgroud)
代替
CORRECT: [self performSegueWithIdentifier:@"ShowVerify" sender:self];
Run Code Online (Sandbox Code Playgroud)
所以检查你是否正在调用performSegueWithIdentifier方法:)
Anb*_*hik 11
use segue identifier in Push Method and give the proper connection
Run Code Online (Sandbox Code Playgroud)
如果您正在使用Identifier
,请在您需要的地方拨打此线路
[self performSegueWithIdentifier:@"identifierName" sender:self];
Run Code Online (Sandbox Code Playgroud)
Swift 2.X
self.performSegueWithIdentifier("identifierName", sender: self)
Run Code Online (Sandbox Code Playgroud)
斯威夫特3
self.performSegue(withIdentifier: "identifierName", sender: self)
Run Code Online (Sandbox Code Playgroud)
关于新屏幕,你已经添加了这种方式.在那个屏幕上,当你完成并想要删除它时,它只是:
self.dismiss(animated: false, completion: nil)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
23160 次 |
最近记录: |