Search code examples
iosdebugginginstruments

iOS 7 Storyboards Debug Advice


I'm working on a iPhone app using Storyboards and iOS 7.

For some reason a push segue from screen to the next takes 3 seconds and I simply cannot figure out how to debug this.

I know this is a very generic question, but could any advise on what I should look out for or what tools i need to use to improve the user experience.

There's nothing 'heavy' occurring in the 2 view controllers. There's literally a protocol in the header files that allows for data to be sent back.

Any help would be appreciated.

Thank you.

--

Adding more specifics:

In my storyboard. In view A i have a button. From that button I have dragged to view B and created a push segue. In View A i also have the method:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
     if([segue.identifier isEqualToString:@"page2topage3"]){
        FormPage3ViewController *controller = (FormPage3ViewController *)segue.destinationViewController;
        controller.userData = _userData;
        //This is for the delegate to pass back the array
        controller.delegate = self;
    }

}

Solution

  • The destination view controller maybe taking a long time to instantiate. In this case, FormPage3ViewController. Check your -init method.

    If that is not it, your best bet to find out what is happening is to use Instruments. Launch it from Xcode using cmd+i. Select 'Time Profiler'. Wait a few seconds until the app has completely finished launching and run the action that causes the segue to execute. You should see something like this:

    Instruments Activity

    Once the segue has finished executing, you can tell Instruments to stop recording. After that, select that area of interest by clicking on the timeline and using the inspection range buttons until you have something like this:

    Instruments Inpection Range

    Ensure you have the extended detail view active. It is a panel on the right that can be activated by clicking on the button marked in red:

    Instrument Views

    And select the first thread of the list:

    Thread List

    In the extended detail view you should see the heaviest stack trace happening when you execute the segue, which should give you a good idea of what could be going on. Click on the items in black (your code) in the extended detail to see more detail on the thread list or double click to get to the line of code directly:

    Extended Detail View