NEW: Subscribe to Hacking with Swift+ and accelerate your learning! >>

Project 25 - app crashes when try to " Host a session"

Forums > 100 Days of Swift

Hey Guys, is anyone else having trouble with just trying to host a session? My app crashes immedietly (both on my phone or in simulator) when attempted, with this error message : Thread 1: "-[MCAdvertiserAssistant advertiser:didNotStartAdvertisingPeer:]: unrecognized selector sent to instance 0x2834b8fc0"

I read through the other 2 forums related to project 25 and made the changes below:

  1. Go to Info.plist in your project and delete Application Scene Manifest row.
  2. Go to AppDelegate.swift and add var window: UIWindow? in the class.
  3. In the same class, delete everything below // MARK: UISceneSession Lifecycle line.

BUT it still didn't work for me.

   

Hello!

Your problem stems from Apple's shenanigans introduced along with iOS 14.

Try to insert the following fields in the info.plist:

  1. Privacy - Local Network Usage Description
  2. Bonjour services with the following initialisation: _service._tcp and _service._udp

Hope it helps!

   

Hi,

I'm having issues as well. I tried both of what teekachu and MateusZ have written. Simulator doesn't give errors whether I select host or select join session, but it does prompt to accept incoming network connections (probably a macOS thing). My iPhone does not prompt to accept connections, and I get an errors with both host and join session selection. When I select host session:

2020-10-02 16:44:40.563044-0500 SelfieShare[2894:993220] [MCNearbyServiceAdvertiser] Server did not publish: errorDict [{
    NSNetServicesErrorCode = "-72008";
    NSNetServicesErrorDomain = 10;
}].
2020-10-02 16:44:40.563461-0500 SelfieShare[2894:992948] -[MCAdvertiserAssistant advertiser:didNotStartAdvertisingPeer:]: unrecognized selector sent to instance 0x283c51340
2020-10-02 16:44:40.563924-0500 SelfieShare[2894:992948] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MCAdvertiserAssistant advertiser:didNotStartAdvertisingPeer:]: unrecognized selector sent to instance 0x283c51340'

When I select join session, the error is almost the same, but basically has "Browser" instead of "Advertiser".

Xcode 12, iOS 14

   

@poke-peek, did you replace _service in _service._tcp and _service._udp with what you use when initializing MCAdvertiserAssistant, in my case serviceType is bball-service so I had to add _bball-service._tcp and _bball-service._udp in the plist file.

   

Hacking with Swift is sponsored by Fernando Olivares

SPONSORED Ever ask for help and your reviewer immediately notices issues you missed? Fernando Olivares is a 10-year veteran from Big Nerd Ranch and Lambda School who can help hone your app building skills, and he's just launched a new book that does just that – use the code "hacking" to save $5!

Buy the book

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

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

Not logged in

Log in
 

Link copied to your pasteboard.