BLACK FRIDAY SALE: Save 50% on all my Swift books and bundles! >>

Project 25 - Multipeer Connectivity not working due to new security setting??

Forums > 100 Days of Swift

I'm having trouble with this project, however, my issue is that the multipeer connection times out. I start by running it on the simulator and host the session. When I run it on my connected iOS device and join session, I can see the simulator and when I try connecting, I never get prompted on the simulator to accept/decline. This must be a security/entitlement setting but I cannot figure out what needs to be added.

Anyone know how to resolve this?


I faced the same issue when I did the project a few weeks back, but couldn't find an answer either. Ran it through a whole load of different combinations of iPad / iPhone / simulator with no effect.


I was able to get passed it but I wasn't able to figure out the issue. I only got past it by using Paul's project from the master project files. I opened his project, ran it and it worked. It's definitely not a coding issue because the only code file in the project is the viewcontroller and I had already used his VC file in my project and still didn't work. So it's a security setting or entitlement that needs to be added as I originally thought, but I still can't figure out what to add. At least this way I can proceed with the challenges.


same problem here. the host is never prompted to accept/decline and the session on the device trying to join times out. anyone found the solution to that?


Hi guys,

I had a similar problem at the time and have looked backed at my code. I think the only issue was to do with using the "MCAdvertiserAssistant", this needed to be changed to "MCNearbyServiceAdvertiser". As a result i think the changes that are needed are:

  1. Your properties needed updated: var mcAdvertiserAssistant: MCAdvertiserAssistant?


    var mcAdvertiserAssistant: MCNearbyServiceAdvertiser?

  2. Your startHosting function needs update: mcSession = MCSession(peer: peerID, securityIdentity: nil, encryptionPreference: .required) mcSession?.delegate = self


    mcAdvertiserAssistant = MCNearbyServiceAdvertiser(peer: peerID, discoveryInfo: nil, serviceType: "hws-project25") mcAdvertiserAssistant?.delegate = self mcAdvertiserAssistant?.startAdvertisingPeer()

    I'm pretty sure that's all i changed to get it going and for the prompt to appear. If that doesn't work let me know, as i definitely got it going at the time and i will go back and rebuild it all to check what i did.




Hacking with Swift is sponsored by Guardsquare

SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP.

Learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.