pub unsafe trait CMFallDetectionDelegate: NSObjectProtocol {
// Provided methods
unsafe fn fallDetectionManager_didDetectEvent_completionHandler(
&self,
fall_detection_manager: &CMFallDetectionManager,
event: &CMFallDetectionEvent,
handler: &DynBlock<dyn Fn()>,
)
where Self: Sized + Message { ... }
unsafe fn fallDetectionManagerDidChangeAuthorization(
&self,
fall_detection_manager: &CMFallDetectionManager,
)
where Self: Sized + Message { ... }
}
CMFallDetectionManager
only.Expand description
CMFallDetectionDelegate
CMFallDetectionManager notifies its delegate about Fall Detection related information using this protocol
See also: CMFallDetectionManager
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn fallDetectionManager_didDetectEvent_completionHandler(
&self,
fall_detection_manager: &CMFallDetectionManager,
event: &CMFallDetectionEvent,
handler: &DynBlock<dyn Fn()>,
)
Available on crate features CMFallDetectionEvent
and block2
only.
unsafe fn fallDetectionManager_didDetectEvent_completionHandler( &self, fall_detection_manager: &CMFallDetectionManager, event: &CMFallDetectionEvent, handler: &DynBlock<dyn Fn()>, )
CMFallDetectionEvent
and block2
only.Update the delegate with a new Fall Detection event
Parameter handler
: Apps running in the background have a finite amount of time to process Fall Detection events. Call this handler to indicate that the app has finished handling the event. The system may suspend or terminate the app before calling this block.
Fall Detection events may occur when the app is not running. Following a Fall Detection event, the system will launch the watchOS app in the background giving it small amount of background execution time. This time should be used for critical tasks related to the Fall Event. For example: placing a network request or scheduling a local notification. In order to receive Fall Detection events, create a new CMFallDetectionManager instance and set its delegate early in the watchOS app lifecycle (applicationDidFinishLaunching for example). Note that instances of WKInterfaceController may not be created when launched in the background.
If multiple Fall Detection events are generated while the app is not running, only the most recent event will be reported on the next app launch.
The same event may be reported across different app launches, always check the date of the event before processing it.
Fall Detection events can be simulated with the watchOS simulator. Use it to test the background functionality of your app.
Sourceunsafe fn fallDetectionManagerDidChangeAuthorization(
&self,
fall_detection_manager: &CMFallDetectionManager,
)
unsafe fn fallDetectionManagerDidChangeAuthorization( &self, fall_detection_manager: &CMFallDetectionManager, )
Update the delegate when the app’s Fall Detection authorization status changes