3

所以有点历史。这是我发布的应用程序中的工作代码。它在 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";
}
4

0 回答 0