没有通过蓝牙获得EA通知

时间:2013-05-06 21:08:25

标签: ios external-accessory

当通过USB而不是通过蓝牙连接到外部设备(符合MFi)时,我能够收到EA通知。为什么不通过蓝牙连接触发EA通知,这与文档建议相反?

1 个答案:

答案 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);
}