I have problems to join a share play group session programmatically.
First I create on one device a SharePlay Activity
await SharePlayGame().activate()
If this was successful the creator listen to the session
private func startSession() async {
for await session in SharePlayGame.sessions() {
configureGroupSession(session) // do session stuff
}
}
This is working so far. Now the second device will join. I call just startSession
But then nothing happens. My assumption was that the created session is shared by SharePlay
or the FaceTime connection.
Anyway, when I open FaceTime I see that there is an open session. FaceTime offers me the action to join the GroupSession. If I press this everything work fine and my devices are connected (see image). Any further events between this devices are working as expected.
When I use await SharePlayGame().activate()
for the joining process a new SharePlay Group Session is created. This always show the system dialog ("Do you want replace the current SharePlay Session?") Then my code works, too, but this cannot be the right way.
How is the correct way to join (or find?) the GroupSession and join.
2
Answers
Ok, I found it out. At the moment it seems that this is not possible. I watched all WWDC videos and check the whole documentation. I tried a lot of other apps from big players and everybody join the session by FaceTime.
Edit: I read in the release notes for 15.4 that it's now possible. But I did not find any iOS docu.
It looks to me as though you set up a
GroupSession
, but haven’t started one.Any device can wait for a
GroupSession
on a particularGroupActivity
. The session does not begin for any device until one of them activates theGroupActivity
. The two are separate. The app should start a task waiting for aGroupSession
as soon as it can handle the session.There’s also the fun of deciding when to activate the
GroupActivity
. Activating it when a session for that activity already exists will attempt to replace the existing session. The system will interrupt the user, asking if they want to replace the existing session, with ambiguous results.A
GroupSession
is specific to a particularGroupActivity
. An app may be able to participate is sessions for multiple activities, though I have not tested. As of WWDC 2022, Apple says that an app can have multipleGroupSessionMessenger
on aGroupSession
.