I have been working on an app implementing the Multipeer Connectivity (MC) framework. When running the app through Xcode for the first time on two separate phones, phoneBob and phoneJack, I initialize an MCSession for phoneBob under the displayName 'BobA' and an MCSession for phoneJack under the displayName 'JackA'. MC for phoneBob finds 'JackA' just fine and vice versa, and the two can connect with no problems.
However, After deleting the app and rerunning through Xcode, I initialize an MCSession for phoneBob under the displayName 'BobB' and an MCSession for phoneJack under the displayName 'JackB'. In addition to phoneBob finding the foreign peer 'JackB' who can be connected to successfully, it also finds the foreign peer 'JackA' in the log, even though 'JackA' cannot be connected to and was associated with a previous version of the app. This happens vice versa as well, where phoneJack finds not only the foreign peer 'BobB', but the foreign peer 'BobA' as well. Not Only this, but phoneBob will actually find ITSELF for both installations of the app, 'BobA' and 'BobB' as foreign peers, and phoneJack will find itself, 'JackA' and 'JackB' as foreign peers.
I call these foreign peers from previous installations of the app that cannot be connected to 'ghost peers'. The more times I uninstall and rerun the app through Xcode, the greater the amount of these ghost peers that are found by MC. Note that these ghost peers only appear upon the second and subsequent runs of the app following a deletion of the app. Restarting the phone and running the app gets rid of these ghost peers, but I am just utterly confused as to why MC would find ITSELF as a foreign peer as well as peers that don't actually exist. Is it possible that upon second installation of the app, MC is picking up on a ghost session from the first installation of the app that for some reason was never terminated? Is it possible for the session we initialized in the first installation to persist even after the app is deleted?