1

In my appDelegate.m I'm running this:

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    NSLog(@"url recieved: %@", url);
    NSLog(@"query string: %@", [url query]);
    NSLog(@"host: %@", [url host]);
    NSLog(@"url path: %@", [url path]);
    NSDictionary *dict = [self parseQueryString:[url query]];
    NSLog(@"query dict: %@", dict);
    if([[url host] isEqual: @"success"]){
        RegistrationController *rc = [RegistrationController alloc];
        [rc regSuccess];
    }
    else if([[url host] isEqual: @"fail"]){
        RegistrationController *rc = [RegistrationController alloc];
        [rc regFailed];
    }
    return YES;
}

In my registrationcontroller.m I have this

-(void)regSuccess{
    NSLog(@"REGSUCCESS!!!:D");
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    WaitController *rc = [storyboard instantiateViewControllerWithIdentifier:@"waitcontroller"];
    [self.navigationController pushViewController:rc animated:NO];
}
-(void)regFailed{
    NSLog(@"REGFAILED!!!:(");
    [UIView animateWithDuration:1.0 animations:^{
        _wheel.alpha = 0.0;
}];
}

When I connect to my url scheme on my phone, I get redirected to the app, and the console does print out REGSUCCESS!!!:D so I know that the method inside of registrationcontroller.m was called. The problem that I'm having, is that the wait controller is not pushed, or any other manipulation of objects from within the regSuccess method is working. Been searching a fix for this for hours with no luck :(. Please Help.

Notes: I have already implemented the regSuccess and regFailed methods inside the registrationcontroller.h

Thanks!

4

1 回答 1

0

一个可能的原因是[self.navigationController pushViewController..]可能不工作是self.navigationController可能不存在。重要的是 aUINavigationController已经在沿线的某个地方引入,无论是在 a XIB、 aStoryboard还是以编程方式。可能值得注意的是,如果导航控制器包含在您在代码中引用的情节提要中,这将不起作用,因为您试图将控制器推送到您没有的控制器内的导航控制器上推了。重要的是验证如果您在 XCode 中设置断点并查看您的regSuccess方法,您应该self.navigationController在调试器中看到一个有效的指针。如果你没有一个,你将无法推动任何事情。

如果您确认导航控制器存在(并且它的视图层次结构本身已添加到应用程序的视图层次结构中),您接下来需要查看您尝试添加的视图本身。大概是这样rc.view。如果您调用以下命令而不是添加到导航堆栈会发生什么情况:

[[self view] addSubview:[rc view]];

此外,通过使用调试器检查变量或仅记录变量,评估 rc.view 的属性。它的框架是什么?它应该出现在哪里?视图是否未正确创建?

于 2013-08-28T00:05:07.840 回答