Receiver(<viewcontroller>)没有带标识符的segue

时间:2015-07-14 21:52:52

标签: ios objective-c iphone uiviewcontroller segue

我不知道并尝试重命名故事板,清理项目,更换模拟器。我无法通过segue工作。

我有一个从ViewController(A)到ViewController(B)的手动建模segue,名为“MoveToLogin”。

当您单击登录按钮时,我创建了一个自定义对象的新实例,其中包含一个登录方法,如下所示:

#ViewController.m
//If the username and password fields are not blank, attempt to log in.
        [_custom object loginUser:_usernameTxt.text password:_passwordTxt.text]

#custom object's login method (CustomObject.m)
-(void)loginUser:(NSString *)username password:(NSString *)password
{
    ViewController *viewcontroller = [[ViewController alloc]init];

    //Attempts to log in the user
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    NSDictionary *params = @ {@"username" : username, @"password": password};
    [manager POST:_login_url parameters:params
    success:^(AFHTTPRequestOperation *operation, id responseObject)
    {
        if([responseObject objectForKey:@"login_okay"])
        {
            _valid_login = YES;
            [viewcontroller onSuccessfulLogin];
        }
        else
        {
            _valid_login = NO;
            [viewcontroller onInvalidLogin];
        }
    }
          failure:
     ^(AFHTTPRequestOperation *operation, NSError *error) {
         [viewcontroller onRequestFail];
     }];
}

正如你可以看到自定义对象的方法,显然是在另一个类中,当从服务器接收到json响应时,调用ViewController(a)方法onSuccessfulLogin。

该方法如下:

-(void)onSuccessfulLogin
{
    //if we get a successful login
    [self performSegueWithIdentifier:@"MoveToLogin" sender:nil];
}

但每当我成功登录时,都会收到这条令人愉快的消息:

  

因未捕获的异常而终止应用   'NSInvalidArgumentException',原因:'Receiver()没有带标识符'MoveToLogin'的segue''

0 个答案:

没有答案