UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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?

3      

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.

3      

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.

3      

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?

3      

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?

    ....becomes...

    var mcAdvertiserAssistant: MCNearbyServiceAdvertiser?

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

    ...becomes....

    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.

    Cheers,

    Si.

3      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

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.