Richard Knop
Richard Knop

Reputation: 83705

Segue crashing - debugger doesn't display any useful error

UPDATE:

Ok, I managed to log the exception:

[<TweetDetailViewController 0x685f9f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key toolbar.

I have a toolbar in the target controller view. Could that be causing the problem?


I have no idea what the heck is going on. I have not changed segues at all and they worked perfectly few minutes ago. I was changing some unrelated things in a detail view controller and now the app crashes during segue from the root to the view controller.

I am trying to debug this. Here is where the code crashes:

enter image description here

Step over:

enter image description here

Step over:

enter image description here

Step over:

enter image description here

Ok, here is the setter method which is being called in prepareForSegue:

- (void)setTweet:(Tweet *)newTweet
{
    if (_tweet != newTweet) {
        _tweet = newTweet;
    }
}

I call a configuration method when entering the detail controller:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    [self configureView];
}

- (void)configureView
{
    // Update the user interface for the tweet detail page
    if (_tweet) {

        self.tweetUserName.text = _tweet.userName;
        self.tweetCreatedAt.text = _tweet.createdAt;
        self.tweetText.contentInset = UIEdgeInsetsMake(-4,-8,0,0);
        self.tweetText.text = _tweet.text;

        if (_tweet.retweeted == YES) {
            [self.retweetButton setTintColor:[UIColor grayColor]];
            [self.retweetButton setEnabled:NO];
        }

        if (!_tweet.userProfileImage) {
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSString *imageUrl = _tweet.userProfileImageUrl;
                NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]];

                dispatch_async(dispatch_get_main_queue(), ^{
                    self.tweetUserProfileImage.image = [UIImage imageWithData:data];
                });
            });
        }
        else {
            self.tweetUserProfileImage.image = _tweet.userProfileImage;
        }

    }
}

Upvotes: 4

Views: 2574

Answers (2)

Phillip Mills
Phillip Mills

Reputation: 31016

Copied from comments, as an answer once the actual exception was revealed:

Most likely the TweetDetailViewController in your storyboard has some connection that links to an outlet called "toolbar" but the code for that class doesn't have a property with that name. That's the usual reason at least for that kind of error when a view controller is involved.

Upvotes: 7

WhiteTiger
WhiteTiger

Reputation: 1691

Try enabling control over the Zombie, to see if the debug gives you more details about the problem.

On edit scheme under the heading "Envirorment Variables" add NSZombieEnabled = YES

Please try and see if you have more details

Upvotes: 1

Related Questions