Debug TVTopShelfProvider in Xcode?

Hey all,


I've created a ServiceProvider that provides Top Shelf items. My original dummy code worked fine and my hard-coded object was displayed. I've now started coding the dynamic update, but it's not working. However, all my debugging code (NSLog) is not showing up in the debugger when my app runs.


I assuming I have to attach to the TVService Extension to see that output, but I'm not sure how to do that fast enough so that I can catch the logging when the app starts. I can see that some of it is working, because I can see my app hitting the json stored on my webserver. 🙂


Tips or advice appreciated!

Accepted Answer

Replying and solving my own question: you can attach to the system logs of the device in the simulator and you'll see the extension logging in there.

| but I'm not sure how to do that fast enough so that I can catch the logging when the app starts


For this sort of thing in general, think low tech. I'd put a "sleep(20);" at the beginning of my topShelfStyle or topShelfItems properties (or methods), or -init of the principal class ("ServiceProvider" by default from the Xcode template), depending on where I wanted to hold things up until I got attached. At least in the case of these TV Services extensions, the system won't care if the extension is slow to return results from any of those methods.

I was able to debug my extension and place a breakpoint in my code to examine the TVContentItem array before it returned to the app. If you change your scheme to the TopShelfProvider Extension you created and run that, it should ask you which process to attach to. Once that is done the next time the app needs the TopShelf items it should hit your breakpoint.

Debug TVTopShelfProvider in Xcode?
 
 
Q