Questions tagged [cfnotification]
7 questions
5
votes
1 answer
How to Receive Darwin Notifications when app is in background
App is configured to receive location updates while in the background so as to keep the app active and the updates are being received successfully when app is in the background.
Darwin notifications have also been configured and are received only…

Rich16
- 87
- 7
4
votes
1 answer
How can I send a userInfo dict using CFNotificationCenterGetDarwinNotifyCenter()
I need to send an object using CFNotificationCenterGetDarwinNotifyCenter() however, I'm noticing that whenever I send a notification using
const void *tkeys[1] = { @"testKey" };
const void *tvalues[1] = { @"testValue" };
CFDictionaryRef userInfo =…

gran_profaci
- 8,087
- 15
- 66
- 99
2
votes
2 answers
Using CFNotificationCallback in Swift, or, @convention(c) blocks in Swift
I am trying to listen to CoreTelephony notifications using the (now private) CTTelephonyCenterAddObserver C function and CFNotificationCallback callback blocks.
My bridging header (to extern the private C functions):
#include…

JAL
- 41,701
- 23
- 172
- 300
2
votes
1 answer
Total screen unlock time calculation in iOS
For my current project, I need to calculate the total time while an iOS device is unlocked i.e. the user is working on his device. I am aware of the Darwin Notifications as available in CFNotificationCenter as specified in this Stackoverflow…

Sauvik Dolui
- 5,520
- 3
- 34
- 44
0
votes
0 answers
How to receive CFNotification in console application from Application in swift (OSX)
I am sending CFNotification from UIApplication to console application.
But i did not get the notification into console application.
here is my code.
// Posting notification from UIApplication
// this code in objective-c
CFNotificationCenterRef…

Ashkar
- 35
- 7
0
votes
1 answer
Check Device screen On or Off in iOS
Helle there, I'm using the code below to check whether the device's screen is on or off. I got this code from this SO post.
Code:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func…

Pratik Prajapati
- 1,137
- 1
- 13
- 26
0
votes
0 answers
CFNotificationCenter repeating events statements
I have been working on an enterprise iOS/Swift (iOS 11.3, Xcode 9.3.1) app in which I want to be notified if the screen changes (goes blank or becomes active) and capture the events in a Realm databse. I am using the answer from tbaranes in detect…

RLW
- 1
- 2