Tag: core telephony

在Swift中使用CFNotificationCallback,或在Swift中使用@convention(c)块

我正在尝试使用(现在私有的) CTTelephonyCenterAddObserver C函数和CFNotificationCallback回调块来侦听CoreTelephony通知。 我的桥接头(外部私有C函数): #include #if __cplusplus extern “C” { #endif #pragma mark – API /* This API is a mimic of CFNotificationCenter. */ CFNotificationCenterRef CTTelephonyCenterGetDefault(); void CTTelephonyCenterAddObserver(CFNotificationCenterRef center, const void *observer, CFNotificationCallback callBack, CFStringRef name, const void *object, CFNotificationSuspensionBehavior suspensionBehavior); void CTTelephonyCenterRemoveObserver(CFNotificationCenterRef center, const void *observer, CFStringRef name, const void *object); void CTTelephonyCenterRemoveEveryObserver(CFNotificationCenterRef center, […]