gpt4 book ai didi

iOS 游戏 Controller 框架 : How to use "startWirelessControllerDiscoveryWithCompletionHandler"

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:18:07 25 4
gpt4 key购买 nike

当游戏 Controller 从系统设置配对时,一切正常。

但我想在我的应用中发现并配对游戏 Controller 。

其实通过苹果的文档我发现好像是可行的。 doc link : Discovering and Connecting to Controllers .

我有一个正在配对的游戏 Controller ...

但我发现函数“startWirelessControllerDiscoveryWithCompletionHandler”的日志从未显示。

似乎行为不符合。

我在应用加载时调用“startWirelessControllerDiscoveryWithCompletionHandler”...

我也调用“stopWirelessControllerDiscovery”,但还是一样。

- (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__);
}
}

有人有这方面的经验吗?

最佳答案

根据我的经验,它不适用于 Controller 配对 - 我总是不得不将我的游戏 Controller 直接与设备配对。我一直在围绕 GCController 开发一个包装器,所以我测试了大约 5 个不同的 MFi Controller ,但没有让 GCController 管理配对过程。

关于iOS 游戏 Controller 框架 : How to use "startWirelessControllerDiscoveryWithCompletionHandler",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28188411/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com