由于 IOS7 中的某些方法贬值,我正在尝试修改以前编写的代码部分:
CFUUIDRef peripheralUUID = CFUUIDCreateFromString(NULL, (CFStringRef)deviceUUID); //deviceUUID was previously assigned with string
[_manager retrievePeripherals:[NSArray arrayWithObject:(id)peripheralUUID]];
之前的代码运行良好,但由于“retrievePeripherals”在 IOS7 中不再存在,我在相同的环境下进行了以下调整:
NSUUID *nsuuid = [[NSUUID alloc]initWithUUIDString:deviceUUID];
NSArray *uuids = [[NSArray alloc]initWithObjects:nsuuid, nil];
NSArray *connectedPeripherals = [_manager retrievePeripheralsWithIdentifiers:uuids];
然后出现错误,例如[CBConcreteCentralManager retrievePeripheralsWithIdentifiers:]: unrecognized selector sent to instance 0x1fd2b1b0
内存地址指向_manager,
存储的 NSUUID 类似于 <__NSConcreteUUID 0x210dd370> 1FDAA349-BB09-DA19-FD9E-39077890F003
而且我确定数组uuids已加载对象。
我不确定哪些部分搞砸了,任何帮助将不胜感激。