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
Simen Anthonsen
1,097 PointsUIAlertAction working, but receiving error from Xcode
I am making a search function, where you can search for friends. I have 2 AlertActions. One for success(if you find a friend) and one for failure. A My code is like this for friend in friends { if friend == searchText { presentViewController(sucessAlert, animated: true, completion: nil) } else { presentViewController(failureAlert, animated: true, completion: nil) } It is working like I expected it to, but I am receiving print errors from Xcode saying "Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UIAlertController: 0x7b29a600>"
After searching the internet, I found out many have got the same problem and errors. And it is most likely because I have created an UIAlertAction that always doesn´t get called, seeing as i have made two UIAlertActions.
How do you fix this?