Crashy sharing popover controller

hi everybody,

I thought I’d post this question here and see how that goes…

I was doing this tutorial:

so when I make the app in the tutorial, it crashes when I run or simulate it on an iPad.

i’m just learning here, so I’ve asked around and one person said:

the tutorial doesn’t mention the popoverPresentationController, so that code will crash on iPad iOS 9.x. The solution would be to add vc.popoverPresentationController?.barButtonItem = navigationItem.rightBarButtonItem before you present the view controller.

i had also tried:

vc.popoverPresentationController?.barButtonItem = sender as? UIBarButtonItem

both still crashed. What am I doing wrong? while i’m here, how do i populate the popover with the different share services such as Facebook, twitter, etc?

It would be nice to see a tutorial explaining how to make the sharing button bring up a popover or whatever kind of controller and populate it with whatever services I want, or are available… I’m not exactly sure how to do that.