我正在为我的iOS-BLE项目使用来自RedBearLab的RedBearLab。我为iOS 7设计了一个应用程序,但Xcode在TableViewController.h中显示了“isConnected”。我不是一个程序员,所以我需要一些帮助来编辑代码来保持它的功能。谢谢。下面是代码。
(IBAction)btnScanForPeripherals:(id)sender{ if (ble.activePeripheral) ble.activePeripheral //!'isConnect‘被废弃。在iOS 7.0 { [ble CM取消外围连接:ble activePeripheral];btnConnect setTitle:@"Connect“forState:UIControlStateNormal;返回;}
if (ble.peripherals)
ble.peripherals = nil;
[btnConnect setEnabled:false];
[ble findBLEPeripherals:2];
[NSTimer scheduledTimerWithTimeInterval:(float)2.0 target:self selector:@selector(connectionTimer:) userInfo:nil repeats:NO];
[indConnecting startAnimating];}
另一个问题是UUID在iOS 7.0中也不受欢迎。
if (!service)
{
printf("Could not find service with UUID %s on peripheral with UUID %s\r\n",[self CBUUIDToString:serviceUUID],[self UUIDToString:p.UUID]);
return;
}我能做些什么来修复它吗?谢谢
发布于 2014-02-08 02:08:50
有点晚了,但我找到了.isconnected的答案。不过,我仍在研究UUID
if(ble.activePeripheral.state == CBPeripheralStateConnected)https://stackoverflow.com/questions/19576474
复制相似问题