2

When game controller be paired from system setting, all is fine.

But I want to discover & pair game controller in my app.

Actually I found that it seems feasible by Apple's docs. doc link : Discovering and Connecting to Controllers.

I have a game controller which is in pairing...

But I found the log of function "startWirelessControllerDiscoveryWithCompletionHandler" never be shown.

Seems the behavior does not conform.

I call "startWirelessControllerDiscoveryWithCompletionHandler" when app load...

I also call "stopWirelessControllerDiscovery", but still same.

- (void)viewDidLoad {

 ...

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gameControllerDidConnect:) name:GCControllerDidConnectNotification object:nil];
 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gameControllerDidDisconnect:) name:GCControllerDidDisconnectNotification object:nil];

 [GCController startWirelessControllerDiscoveryWithCompletionHandler:^{
    NSLog(@"Finished finding controllers");
    [self completionWirelessControllerDiscovery];
 }];

 ...
}

- (void)completionWirelessControllerDiscovery {
    if (isDebug) {
        NSLog(@"%s-%d", __FUNCTION__, __LINE__);
    }
}

Someone has experiences on this?

Kirit Modi
  • 23,155
  • 15
  • 89
  • 112
Gray lin
  • 33
  • 5

1 Answers1

1

My experience has been that it does not work for pairing a controller - I have always had to pair my game controllers directly to the device. I've been developing a wrapper around GCController, so I've tested about 5 different MFi controllers with no luck getting GCController to manage the pairing process.

Rob Reuss
  • 1,400
  • 10
  • 20