Installing this profile does indeed allow the console app to display activity of a connected Apple Watch. Thanks!But I can't get the logs to reappear in Console after running an app in XCODE on the Apple Watch. When the Apple Watch is selected as a run destination, it's messages are displayed in the XCODE console, as expected. But after XCODE is closed, I can't get the messages from the Apple Watch to go back to being displayed in the console app.Anyone have any advice?
Post
Replies
Boosts
Views
Activity
Just the kind of experienced input I was hoping to find! Thanks so much for your quick and helpful reply. If anyone else has had similar or differing experiences with CloudKit, I hope to hear you as well.
While PBK's gamekit suggestion seemed perfect, after implementing, I see that Game Center limits to peer to peer are 4 players per GKMatch. Could someone recommend another method of communicaing small amounts of near real-time data from one app instance to another across the internet for 20 or so users at a time? Extra credit for an Apple framework that can handle the security and server items. Thanks in advance!
Game Center does work over the internet, and I'm currently experiementing with creating multiple GKMatch(es) on the "lead" device so that more than 4 'followers' can be connected. Thanks for the recommendation of Firebase, I'll take a look if I can't get GameKit to work. I hope I can, as staying inside Apple walls makes me feel safe ;-) I'll update in a few days when I have more experience with testing.
I have mixed results to report. I've been able to achieve most of my objectives with an atypical GameKit implementation:Follower starts:[[GKLocalPlayer localPlayer] registerListener:self];request = [[GKMatchRequest alloc] init]; request.minPlayers = 2; request.maxPlayers = 2; request.playerAttributes = 0x0000000F;request.playerGroup = groupName; [[GKMatchmaker sharedMatchmaker] findMatchForRequest:request...Leader starts:[[GKLocalPlayer localPlayer] registerListener:self];request = [[GKMatchRequest alloc] init];request.minPlayers = 2;request.maxPlayers = 2;request.playerAttributes = 0xFFFFFFF0;request.playerGroup = groupName; [[GKMatchmaker sharedMatchmaker] findMatchForRequest:request...You can update UI with the completion handlers, but don't count on a real match until:- (void)match:(GKMatch *)match player:(GKPlayer *)playerdidChangeConnectionState:(GKPlayerConnectionState)state{ use the match / player combo to note the connection for both leader and follower. Add to array of followers for leader. If Leader, call your leader code again}Send data to either with:[match sendData:encoder.encodedData toPlayers:playerArray dataMode:GKMatchSendData(Un)reliableerror:&error]; and receive in:- (void)match:(GKMatch *)matchdidReceiveData:(NSData *)dataforRecipient:(GKPlayer *)recipientfromRemotePlayer:(GKPlayer *)player{ // you've got mail from player!} So far, so good. Here's the bad news: depending on network strength, connections disconnect regularly. Even though I've built in dependable reconnect code, it can take up to 15 seconds to reconnect so it really isn't a good "real-time" experience.I'm currently testing with various combinations of data size (sometimes pad it so it's heft may keep the connection) or frequency (sometimes just send a "poke me" message) or tweaking the reliable vs unreliable flag in the send message calls.I can get about 10 followers per leader on a good day, but other times, more than 3 followers cycle between connect, disconnect, reconnect in an unusable fashion.I'm still trying to make usable, but wanted to document my success/failures so far in hopes that I can help many and perhaps get help from a few.Any ideas would be welcomed and any tweaks will be tested and reported.
Great idea that I'll explore if I can't get this current method off the ground. I found a post from a few years ago that implies a 1 second 'poke' message with the GKMatchSendDataReliable will keep sessions active and will test that in the coming days. Will update this post no matter.
I've added a small 'poke' message from each follower to the leader every 0.9 seconds using the GKMatchSendDataReliable message type. The connections may be a bit more reliable, but with more than 7 or so followers, there is still a constant disconnect, reconnect dance that seems to happen.Has anyone successfully kept more than 6 active GKMatch connection pairs on a device for more than a few minutes?If not, are there any data transmission services that anyone would recommend? I wanted to stay in the safety of Apple's services but am willing to look beyond if necessary.PBK, although your daisy chain idea is clever, I fear the reliability might be even worse, as one lost connection would mean multiple lost connections.
PBK, thanks for the reminder of 4 max GKPlayers in a GKMatch, but I'm using a seperate GKMatch for each follower, so a "lawyer" defense is that I never have more than 2 players in each GKMatch... but I'm trying to let one player (the leader) be in many matches at a time. I couldn't find any documentation on that scenario. My tests seem to indicate a cutoff around 7 but at times have had 10 active GKMatches.Your input is very appreciated and leads me to consider having multiple GKMatches of 4. _IF_ the leader could be in 6 concurrent GKMatches and each GKMatch could be with 3 followers, then I'm making progress.If anyone can offer success/failure experience with multiple GKMatches I'd appreciate hearing it.And again, PBK, I'm very grateful for your quick and helpful replies!
Thanks for the updated information! Having 16 in one peer to peer GKMatch will certainly be better than the 8 - 10 individual GKMatch(es) with 2 in each that I've been able to get working so far.
Could you offer an example or pseudocode for best practice to programmatically create such? I imagine it goes like this:
Follower starts:
[[GKLocalPlayer localPlayer] registerListener:self];
request = [[GKMatchRequest alloc] init];
							request.minPlayers = 2;
							request.maxPlayers = 16;
			
request.playerAttributes = 0x0000000F;
request.playerGroup = groupName;										
[[GKMatchmaker sharedMatchmaker] findMatchForRequest:request...
Leader starts:
[[GKLocalPlayer localPlayer] registerListener:self];
request = [[GKMatchRequest alloc] init];
request.minPlayers = 2;
request.maxPlayers = 16;
request.playerAttributes = 0xFFFFFFF0;
request.playerGroup = groupName;
			
[[GKMatchmaker sharedMatchmaker] findMatchForRequest:request request... //(should this completion handler finish matching and call addPlayersToMatch or will that happen automatically?)
Update UI with the completion handlers, but don't count on a real match until:
(void)match:(GKMatch *)match
			 player:(GKPlayer *)player
didChangeConnectionState:(GKPlayerConnectionState)state
{
				//add player to array of followers
				//(should I finish match and call addPlayersToMatch here or is it not necessary?)
}
Send data to either with:
[match sendData:encoder.encodedData toPlayers:playerArray dataMode:GKMatchSendData(Un)reliableerror:&error];
and receive in:
(void)match:(GKMatch *)match
didReceiveData:(NSData *)data
forRecipient:(GKPlayer *)recipient
fromRemotePlayer:(GKPlayer *)player
{ // you've got mail from player!
}
I've tried a few ways of ordering the connections but haven't figured it out yet. I'm not sure if I need to call finishMatchmaking in the leader code after each new peer then addPlayersToMatch, and if so should it be in the findMatchForRequest completion handler or in didConnect? Any additional insight or example would be appreciated.
Sorry to miss those details, it's an iOS app with embedded watchOS extension. Building with Xcode 12.0.1 then submitting using Organizer.
Thanks again, Eskimo, for your quick help. I did as you recommended and found the code signing identifier and bundle ID matched as expected for the app. In the /watchkitsupport2 folder there is one file named "WK" - I think that's the nested watchOS file you mention. When I run codesign for WK file:
Executable=/Users/davenorfleet/Downloads/MyFitnessDJ 2020-10-20 08-19-11/MyFitnessDJ/WatchKitSupport2/WK
Identifier=com.apple.WK
Format=Mach-O universal (armv7k arm6432)
CodeDirectory v=20400 size=453 flags=0x0(none) hashes=9+2 location=embedded
Signature size=4628
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=1 size=60
So it seems the Identifier, com.apple.WK, is being set here from something.
Also, although I use automatic signing for iOS app & watchOS app & watchOS extension, I get a prompt while distributing in Organizer saying that "appname_ needs to be re-signed for App Store Connect distribution." I select automatically manage to continue.
Does that give you any more clues as to what the problem may be?
Deployment for iOS app: iOS 12.0
Deployment for watchOS: 5.0
I updated to Xcode 12.1 & tried updating deployment to iOS 13.6 & watchOS 6.2 but still get the same error.
Thanks for your continued help. Any other ideas?
Seems to still be a problem in iOS 14.1 as I outlined in this post:
https://developer.apple.com/forums/thread/664336
Has anyone filed a bug report?
I'm having this exact issue with Xcode 12.1 - I didn't have it previously and was actively submitting watchOS apps during the times of this original thread.
I've checked my valid architectures and all are set to Standard.
Did anyone find any other causes or ways to get around this?
Thanks for your help, Eskimo! I feel less defeated knowing that you had the same trouble ;-)
I'll try a DTS support ticket and update here if any solution is found in case it can help someone else.