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

iOS Build a Weather App with Swift (Retired) Displaying Our Weather Data Handling Failures

Judy Tsai
Judy Tsai
6,376 Points

Error on UIAlertController

Hi,

When I add in the

self.presentedViewController(networkIssueController, animated: true, completion: nil)

it returns "Cannot convert the expression's type '(UIAlertController, animated: BooleanLiteralConvertible, completion: NilLiteralConvertible)' to type 'BooleanLiteralConvertible'

The code for the error handling is as follows:

let networkIssueController = UIAlertController(title: "Error", message: "Unable to load data. Connectivity Error", preferredStyle: .Alert)                    
                    self.presentedViewController(networkIssueController, animated: true, completion: nil)
Justin Dawkins
Justin Dawkins
9,080 Points

A simple change is needed here:

self.presentedViewController(networkIssueController, animated: true, completion: nil)

It should be self.presentViewController:

self.presentViewController(networkIssueController, animated: true, completion: nil)