通过故事板segue传递的属性中的空值

时间:2012-12-31 02:26:13

标签: ios6 null storyboard segue

所以有点历史。这是我发布的应用程序中的工作代码。它在iOS 6之前完美运行,现在无法运行。我发现了一个有效但完全不理想的黑客,所以我转向Stackoverflow寻求答案。

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

    if ([segue.identifier isEqualToString:@"GoogleSegue"])
    {
        Band *thisBand = self.band;
        NSString *googleSearchString = thisBand.bandLinks.googleSearchLink;
        NSURL *googleSearchUrl = [NSURL URLWithString:googleSearchString];
        WebViewController *webViewController = segue.destinationViewController;
        webViewController.delegate = (id)self;
        webViewController.url = googleSearchUrl;
        webViewController.navigationItem.title = @"Google";

    } else if ([segue.identifier isEqualToString:@"YouTubeSegue"])
    {

        Band *thisBand = self.band;
        NSString *youTubeString = thisBand.bandLinks.youTubeLink;
        NSURL *youTubeUrl = [NSURL URLWithString:youTubeString];

        WebViewController *webViewController = segue.destinationViewController;
        webViewController.delegate = (id)self;
        webViewController.url = youTubeUrl;

/*This is the magic line, if I comment this out, the values showing up in the 
destination view controller's properties are null.  If I have this NSLog uncommented 
everything works flawlessly.  Does anyone have an explanation? */

    NSLog(@"%@%@", webViewController.url, youTubeUrl);
        webViewController.navigationItem.title = @"You Tube";
}

0 个答案:

没有答案
相关问题