2013-05-06 113 views
1

我可以通过USB连接到外部设备(MFi兼容),但不通过蓝牙获得EA通知。与文档建议相反,为什么不通过蓝牙连接触发EA通知?未通过蓝牙获取EA通知

回答

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