2

I am using the new GCMouse.mice() API on iPadOS 14.

My Bluetooth mouse (Logitech MX Master 2S) is clearly recognized, and I can navigate the OS and even my app with it. If I go to Settings → Accessibility → AssistiveTouch → Devices, my mouse is right there.

However, no matter at what point I call GCMouse.mice(), the result is an empty list, and GCMouse.current is always nil.

Similarly, I listen for GCMouseDidConnect but it never fires.

To reproduce: I added this code to AppDelegate.swift in the default project template.

import UIKit
import GameController  // new

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  // new:
  @objc func showMice() { print(GCMouse.mice()) }
  @objc func newMouse(notification: Notification) { print(notification) }

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    // new:
    Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(showMice), userInfo: nil, repeats: true)
    NotificationCenter.default.addObserver(self, selector: #selector(newMouse), name: NSNotification.Name.GCMouseDidConnect, object: nil)

    return true
  }

  ...

In the console I simply see:

2020-09-21 21:52:52.737457+0200 MouseTest[1639:1517093] Metal API Validation Enabled
[]
[]
[]
[]
[]
...

Is there something I'm missing? Is there maybe an entitlement I don't know about?

Lynn
  • 10,425
  • 43
  • 75

1 Answers1

1

Okay, this seems like a hardware problem with the Logitech MX Master 2S mouse specifically. Another developer tried my code with a different Bluetooth mouse, and saw GCMouse.mice() get populated fine. Yet another developer tried my code on a difference device with the Logitech MX Master 2S mouse, and saw the same behavior I saw.

So, beware: at least some Bluetooth mice act wonky around the new iPadOS 14 GCMouse API. This is as of iOS 14.0.

Lynn
  • 10,425
  • 43
  • 75
  • Well I have the same issue with all my Logitech mice. I bet it's a iPadOS issue. What mouse do your friend have? – Tom Sep 23 '20 at 06:31
  • 1
    I've been trying with wired Logitech & HP mice and it works great! It appears they have issue with Logitech BT mice. – Tom Sep 23 '20 at 07:26