我知道这是一个愚蠢的问题,但还是想问一下。
我有一个旧应用程序,它使用isConnected。现在我收到一个警告说它已经过时了。我可以只删除这行代码而不会有任何影响吗?或者我该如何处理这个问题。对不起我这么迟钝。
这里有一些代码,它来自CBPeripheral框架。
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
{
// Deal with errors (if any)
if (error) {
NSLog(@"Error discovering characteristics: %@", [error localizedDescription]);
[self cleanup];
return;
}
}
- (void)cleanup
{
// Don't do anything if we're not connected
if (!self.discoveredPeripheral.isConnected) // here is where the warning comes {
return;
}
我认为我找到了答案。
- (void)cleanup
{
// Don't do anything if we're not connected
if (CBPeripheralStateDisconnected) {
return;
}
我在我的.h文件中添加了@property(readonly) CBPeripheralState state;,与此同时我没有收到任何错误提示。有人可以验证一下吗?
CBPeripheral
还是其他什么地方?这个问题可能会被标记为非常低质量。 - Tomasz Szulc