1

通过 USB 但不能通过蓝牙连接到外部设备(兼容 MFi)时,我能够收到 EA 通知。与文档的建议相反,为什么没有针对蓝牙连接触发 EA 通知?

4

1 回答 1

0

1) 您是否在 InfoPlist 中正确设置了协议字符串?
2)您是否在蓝牙设备中正确设置了协议字符串?
3)您是否注册了传入连接事件?像这样:

-(void) <someMethod> {     
    [[EAAccessoryManager sharedAccessoryManager] registerForLocalNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(accessoryConnected:)
                                                 name:EAAccessoryDidConnectNotification
                                               object:nil];
}

-(void)accessoryConnected: (NSNotification *)notification {
    EAAccessory *accessory = [[notification userInfo] objectForKey:EAAccessoryKey];
    NSLog(@"%@ connected", accessory.name);
}
于 2013-06-05T12:47:54.043 回答