当通过USB而不是通过蓝牙连接到外部设备(符合MFi)时,我能够收到EA通知。为什么不通过蓝牙连接触发EA通知,这与文档建议相反?
答案 0 :(得分: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);
}