Share via


CBPeripheral.IsConnected 属性

定义

开发人员不应使用此过时属性。 相反,他们应测试 State 属性。

[ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 7, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 7, ObjCRuntime.PlatformArchitecture.Arch64, null)]
[ObjCRuntime.Obsoleted(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual bool IsConnected { [Foundation.Export("isConnected")] [ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 7, 0, ObjCRuntime.PlatformArchitecture.All, null)] [ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 7, ObjCRuntime.PlatformArchitecture.Arch64, null)] [ObjCRuntime.Obsoleted(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, null)] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.IsConnected : bool

属性值

属性

注解

此属性在 iOS 7 中已弃用,并在 iOS 9 中删除。 应使用 State 属性确定连接状态:

if (myPeripheral.State != CBPeripheralState.Connected)
{
   Console.WriteLine("Peripheral is not connected");
}

适用于