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

Setting a delegate with Multipeer Connectivity

I'm getting an error when trying to set a delegate for my session. The error reads, "Use if unresolved identifier 'self' ".

What does this mean ? I'm also getting an error for my start method.

import Foundation
import MultipeerConnectivity

private let myPeerID = MCPeerID(displayName: UIDevice.currentDevice().name)

private let session = MCSession(peer: myPeerID)

session.delegate = self;
//^ Error on this line

//3. Declaring the MCAdvertiser Assistant Object

let assistant = MCAdvertiserAssistant(serviceType: type,
                                        discoveryInfo: nil,
                                        session: session)
assistant.start()
//^ Error on this line