Same here,
[GKLocalPlayer saveGameData: withName: completionHandler:] reported successed
[GKLocalPlayer fetchSavedGamesWithCompletionHandler:] got 0 data
Tried to call “[GKLocalPlayer.localPlayer fetchSavedGamesWithCompletionHandler:nil];” first, still the same.
Try to make thread wait 2sec before fetch, still the same.
Post
Replies
Boosts
Views
Activity
Any one got any idea?
I got a simplest sample here, followed the code from this video:
https://developer.apple.com/videos/play/wwdc2021/10081/
But still not working.
#import "AppDelegate.h"
#import <GameController/GameController.h>
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
[ [ NSNotificationCenter defaultCenter ] addObserver:self selector:@selector( controllerDidConnect: ) name:GCControllerDidConnectNotification object:nil ];
[ [ NSNotificationCenter defaultCenter ] addObserver:self selector:@selector( controllerDidDisconnect: ) name:GCControllerDidDisconnectNotification object:nil ];
[ GCController startWirelessControllerDiscoveryWithCompletionHandler:^
{
NSLog( @"Finished finding controllers" );
} ];
}
-(void)controllerDidConnect:( NSNotification * )notification
{
GCController *controller = notification.object;
[ controller.extendedGamepad.buttonA setValueChangedHandler:^( GCControllerButtonInput * button, float value, BOOL pressed )
{
NSLog(@"controller Button A pressed.");
if ([[[GCController current] physicalInputProfile] isKindOfClass:[GCDualSenseGamepad class]])
{
GCDualSenseGamepad *dualSense = (GCDualSenseGamepad *)[[GCController current] physicalInputProfile];
GCDualSenseAdaptiveTrigger * rightTrigger = dualSense.rightTrigger;
[rightTrigger setModeFeedbackWithStartPosition:0 resistiveStrength:0.9];
}
} ];
[ controller.extendedGamepad.buttonB setValueChangedHandler:^( GCControllerButtonInput * button, float value, BOOL pressed )
{
NSLog(@"controller Button B pressed.");
if ([[[GCController current] physicalInputProfile] isKindOfClass:[GCDualSenseGamepad class]])
{
GCDualSenseGamepad *dualSense = (GCDualSenseGamepad *)[[GCController current] physicalInputProfile];
GCDualSenseAdaptiveTrigger * rightTrigger = dualSense.rightTrigger;
[ rightTrigger setModeVibrationWithStartPosition:0 amplitude:0.5 frequency:0.03 ];
}
} ];
[ controller.extendedGamepad.buttonX setValueChangedHandler:^( GCControllerButtonInput * button, float value, BOOL pressed )
{
NSLog(@"controller Button X pressed.");
if ([[[GCController current] physicalInputProfile] isKindOfClass:[GCDualSenseGamepad class]])
{
GCDualSenseGamepad *dualSense = (GCDualSenseGamepad *)[[GCController current] physicalInputProfile];
GCDualSenseAdaptiveTrigger * rightTrigger = dualSense.rightTrigger;
[ rightTrigger setModeOff ];
}
} ];
}
-(void)controllerDidDisconnect:( NSNotification * )notification
{
}
@end
Yes, I've debugged it step by step, and checked the value one by one. One thing I've notice is that after the setModeWeaponWithStartPosition (or setModeFeedbackWithStartPosition), the mode is still 0 (GCDualSenseAdaptiveTriggerModeOff), I don't know if this is normal.
By the way:
MacOS: Sequoia 15.2
Chip: Apple M1 Ultra
If it metters.
Found out why.
We need to set the Skip install for all the static libraries.