Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Alex Puray
Alex Puray
1,304 Points

UIActivityController Issue

Hello, I've created an application where you can share your photos using the UIActivityController but it only works when I have my data (photo) currently on the view... my share button works fine but when I press the share button with no media on the view it crashes and says this

"NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]"

Any help or ideas would be appreciated!

Thank you and Merry Christmas!!!

1 Answer

Stone Preston
Stone Preston
42,016 Points

would there ever be a reason for someone to press that share button without anything on the view? If not I would only enable/show the button when there is something on the view, or simply not let that view even appear unless it would have media with it.