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

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.

3      

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!

3      

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

3      

@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.

3      

@ladislavklinc - that's correct and thank you for info and guides ...

just for clarification for others [ my case]:

mcAdvertiserAssistant = MCAdvertiserAssistant(serviceType: "cp-project25", discoveryInfo: nil, session: mcSession)

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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.