Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS TodayView Widget breakpoints not working

I'm working through this tutorial and it works just fine on a simulator, except I don't understand how the methods are being called. The today view widget displays fine but when I add breakpoints to the methods (e.g. ViewDidLoad, widgetPerformUpdateWithCompletionHandler) the breakpoints never seem to be called.

I'm trying to figure this out as I've added extra code - e.g. NSLog to display some values within the methods but do not see any output from the NSLog calls.

Can someone explain why the breakpoints are not working? I'm guessing that it has something to do with the extension methods are executing in the 'background' but am not sure.

Thanks

like image 703
Jazzmine Avatar asked Sep 13 '15 16:09

Jazzmine


1 Answers

You are able to have the breakpoints you set in your today extension activate by following the procedure below:

1) Set breakpoint in your extension code (viewDidLoad is a good option to test)

2) Launch your app as you normally would by selecting your app's target and hitting run.

3) Make sure that your extension is installed in the today view (open the today view and hit the edit button to add it if it is not)

4) Close the today view.

5) In Xcode select your today extension target and press the run button. You will be prompted to choose an app to run. Select "Today".

6) You should see the today window appear on the simulator (this also works on the device). Your breakpoint will be hit.

NOTE: You may hit an exception breakpoint in your app prior to the today extension launching because your app is sent to the background. If this happens just skip over the breakpoint and you will hit the breakpoint in your extension as expected. This procedure also allows you to see console statements from your extension.

like image 106
user3847320 Avatar answered Sep 24 '22 05:09

user3847320