WCSessionDelegate

Trait WCSessionDelegate 

Source
pub unsafe trait WCSessionDelegate: NSObjectProtocol {
Show 15 methods // Provided methods unsafe fn session_activationDidCompleteWithState_error( &self, session: &WCSession, activation_state: WCSessionActivationState, error: Option<&NSError>, ) where Self: Sized + Message { ... } unsafe fn sessionDidBecomeInactive(&self, session: &WCSession) where Self: Sized + Message { ... } unsafe fn sessionDidDeactivate(&self, session: &WCSession) where Self: Sized + Message { ... } unsafe fn sessionWatchStateDidChange(&self, session: &WCSession) where Self: Sized + Message { ... } unsafe fn sessionCompanionAppInstalledDidChange(&self, session: &WCSession) where Self: Sized + Message { ... } unsafe fn sessionReachabilityDidChange(&self, session: &WCSession) where Self: Sized + Message { ... } unsafe fn session_didReceiveMessage( &self, session: &WCSession, message: &NSDictionary<NSString, AnyObject>, ) where Self: Sized + Message { ... } unsafe fn session_didReceiveMessage_replyHandler( &self, session: &WCSession, message: &NSDictionary<NSString, AnyObject>, reply_handler: &DynBlock<dyn Fn(NonNull<NSDictionary<NSString, AnyObject>>)>, ) where Self: Sized + Message { ... } unsafe fn session_didReceiveMessageData( &self, session: &WCSession, message_data: &NSData, ) where Self: Sized + Message { ... } unsafe fn session_didReceiveMessageData_replyHandler( &self, session: &WCSession, message_data: &NSData, reply_handler: &DynBlock<dyn Fn(NonNull<NSData>)>, ) where Self: Sized + Message { ... } unsafe fn session_didReceiveApplicationContext( &self, session: &WCSession, application_context: &NSDictionary<NSString, AnyObject>, ) where Self: Sized + Message { ... } unsafe fn session_didFinishUserInfoTransfer_error( &self, session: &WCSession, user_info_transfer: &WCSessionUserInfoTransfer, error: Option<&NSError>, ) where Self: Sized + Message { ... } unsafe fn session_didReceiveUserInfo( &self, session: &WCSession, user_info: &NSDictionary<NSString, AnyObject>, ) where Self: Sized + Message { ... } unsafe fn session_didFinishFileTransfer_error( &self, session: &WCSession, file_transfer: &WCSessionFileTransfer, error: Option<&NSError>, ) where Self: Sized + Message { ... } unsafe fn session_didReceiveFile( &self, session: &WCSession, file: &WCSessionFile, ) where Self: Sized + Message { ... }
}
Available on crate feature WCSession only.
Expand description

—————————– WCSessionDelegate —————————– The session calls the delegate methods when content is received and session state changes. All delegate methods will be called on the same queue. The delegate queue is a non-main serial queue. It is the client’s responsibility to dispatch to another queue if neccessary.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn session_activationDidCompleteWithState_error( &self, session: &WCSession, activation_state: WCSessionActivationState, error: Option<&NSError>, )
where Self: Sized + Message,

Called when the session has completed activation. If session state is WCSessionActivationStateNotActivated there will be an error with more details.

Source

unsafe fn sessionDidBecomeInactive(&self, session: &WCSession)
where Self: Sized + Message,

Called when the session can no longer be used to modify or add any new transfers and, all interactive messages will be cancelled, but delegate callbacks for background transfers can still occur. This will happen when the selected watch is being changed.

Source

unsafe fn sessionDidDeactivate(&self, session: &WCSession)
where Self: Sized + Message,

Called when all delegate callbacks for the previously selected watch has occurred. The session can be re-activated for the now selected watch using activateSession.

Source

unsafe fn sessionWatchStateDidChange(&self, session: &WCSession)
where Self: Sized + Message,

Called when any of the Watch state properties change.

Source

unsafe fn sessionCompanionAppInstalledDidChange(&self, session: &WCSession)
where Self: Sized + Message,

Called when the installed state of the Companion app changes.

Source

unsafe fn sessionReachabilityDidChange(&self, session: &WCSession)
where Self: Sized + Message,

Called when the reachable state of the counterpart app changes. The receiver should check the reachable property on receiving this delegate callback.

Source

unsafe fn session_didReceiveMessage( &self, session: &WCSession, message: &NSDictionary<NSString, AnyObject>, )
where Self: Sized + Message,

Called on the delegate of the receiver. Will be called on startup if the incoming message caused the receiver to launch.

§Safety

message generic should be of the correct type.

Source

unsafe fn session_didReceiveMessage_replyHandler( &self, session: &WCSession, message: &NSDictionary<NSString, AnyObject>, reply_handler: &DynBlock<dyn Fn(NonNull<NSDictionary<NSString, AnyObject>>)>, )
where Self: Sized + Message,

Available on crate feature block2 only.

Called on the delegate of the receiver when the sender sends a message that expects a reply. Will be called on startup if the incoming message caused the receiver to launch.

§Safety

message generic should be of the correct type.

Source

unsafe fn session_didReceiveMessageData( &self, session: &WCSession, message_data: &NSData, )
where Self: Sized + Message,

Called on the delegate of the receiver. Will be called on startup if the incoming message data caused the receiver to launch.

Source

unsafe fn session_didReceiveMessageData_replyHandler( &self, session: &WCSession, message_data: &NSData, reply_handler: &DynBlock<dyn Fn(NonNull<NSData>)>, )
where Self: Sized + Message,

Available on crate feature block2 only.

Called on the delegate of the receiver when the sender sends message data that expects a reply. Will be called on startup if the incoming message data caused the receiver to launch.

Source

unsafe fn session_didReceiveApplicationContext( &self, session: &WCSession, application_context: &NSDictionary<NSString, AnyObject>, )
where Self: Sized + Message,

Called on the delegate of the receiver. Will be called on startup if an applicationContext is available.

§Safety

application_context generic should be of the correct type.

Source

unsafe fn session_didFinishUserInfoTransfer_error( &self, session: &WCSession, user_info_transfer: &WCSessionUserInfoTransfer, error: Option<&NSError>, )
where Self: Sized + Message,

Available on crate feature WCSessionUserInfoTransfer only.

Called on the sending side after the user info transfer has successfully completed or failed with an error. Will be called on next launch if the sender was not running when the user info finished.

Source

unsafe fn session_didReceiveUserInfo( &self, session: &WCSession, user_info: &NSDictionary<NSString, AnyObject>, )
where Self: Sized + Message,

Called on the delegate of the receiver. Will be called on startup if the user info finished transferring when the receiver was not running.

§Safety

user_info generic should be of the correct type.

Source

unsafe fn session_didFinishFileTransfer_error( &self, session: &WCSession, file_transfer: &WCSessionFileTransfer, error: Option<&NSError>, )
where Self: Sized + Message,

Available on crate feature WCSessionFile only.

Called on the sending side after the file transfer has successfully completed or failed with an error. Will be called on next launch if the sender was not running when the transfer finished.

Source

unsafe fn session_didReceiveFile( &self, session: &WCSession, file: &WCSessionFile, )
where Self: Sized + Message,

Available on crate feature WCSessionFile only.

Called on the delegate of the receiver. Will be called on startup if the file finished transferring when the receiver was not running. The incoming file will be located in the Documents/Inbox/ folder when being delivered. The receiver must take ownership of the file by moving it to another location. The system will remove any content that has not been moved when this delegate method returns.

Trait Implementations§

Source§

impl ProtocolType for dyn WCSessionDelegate

Source§

const NAME: &'static str = "WCSessionDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn WCSessionDelegate

Implementations on Foreign Types§

Source§

impl<T> WCSessionDelegate for ProtocolObject<T>

Implementors§