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 { ... }
}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§
Sourceunsafe fn session_activationDidCompleteWithState_error(
&self,
session: &WCSession,
activation_state: WCSessionActivationState,
error: Option<&NSError>,
)
unsafe fn session_activationDidCompleteWithState_error( &self, session: &WCSession, activation_state: WCSessionActivationState, error: Option<&NSError>, )
Called when the session has completed activation. If session state is WCSessionActivationStateNotActivated there will be an error with more details.
Sourceunsafe fn sessionDidBecomeInactive(&self, session: &WCSession)
unsafe fn sessionDidBecomeInactive(&self, session: &WCSession)
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.
Sourceunsafe fn sessionDidDeactivate(&self, session: &WCSession)
unsafe fn sessionDidDeactivate(&self, session: &WCSession)
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.
Sourceunsafe fn sessionWatchStateDidChange(&self, session: &WCSession)
unsafe fn sessionWatchStateDidChange(&self, session: &WCSession)
Called when any of the Watch state properties change.
Sourceunsafe fn sessionCompanionAppInstalledDidChange(&self, session: &WCSession)
unsafe fn sessionCompanionAppInstalledDidChange(&self, session: &WCSession)
Called when the installed state of the Companion app changes.
Sourceunsafe fn sessionReachabilityDidChange(&self, session: &WCSession)
unsafe fn sessionReachabilityDidChange(&self, session: &WCSession)
Called when the reachable state of the counterpart app changes. The receiver should check the reachable property on receiving this delegate callback.
Sourceunsafe fn session_didReceiveMessage(
&self,
session: &WCSession,
message: &NSDictionary<NSString, AnyObject>,
)
unsafe fn session_didReceiveMessage( &self, session: &WCSession, message: &NSDictionary<NSString, AnyObject>, )
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.
Sourceunsafe fn session_didReceiveMessage_replyHandler(
&self,
session: &WCSession,
message: &NSDictionary<NSString, AnyObject>,
reply_handler: &DynBlock<dyn Fn(NonNull<NSDictionary<NSString, AnyObject>>)>,
)
Available on crate feature block2 only.
unsafe fn session_didReceiveMessage_replyHandler( &self, session: &WCSession, message: &NSDictionary<NSString, AnyObject>, reply_handler: &DynBlock<dyn Fn(NonNull<NSDictionary<NSString, AnyObject>>)>, )
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.
Sourceunsafe fn session_didReceiveMessageData(
&self,
session: &WCSession,
message_data: &NSData,
)
unsafe fn session_didReceiveMessageData( &self, session: &WCSession, message_data: &NSData, )
Called on the delegate of the receiver. Will be called on startup if the incoming message data caused the receiver to launch.
Sourceunsafe fn session_didReceiveMessageData_replyHandler(
&self,
session: &WCSession,
message_data: &NSData,
reply_handler: &DynBlock<dyn Fn(NonNull<NSData>)>,
)
Available on crate feature block2 only.
unsafe fn session_didReceiveMessageData_replyHandler( &self, session: &WCSession, message_data: &NSData, reply_handler: &DynBlock<dyn Fn(NonNull<NSData>)>, )
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.
Sourceunsafe fn session_didReceiveApplicationContext(
&self,
session: &WCSession,
application_context: &NSDictionary<NSString, AnyObject>,
)
unsafe fn session_didReceiveApplicationContext( &self, session: &WCSession, application_context: &NSDictionary<NSString, AnyObject>, )
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.
Sourceunsafe fn session_didFinishUserInfoTransfer_error(
&self,
session: &WCSession,
user_info_transfer: &WCSessionUserInfoTransfer,
error: Option<&NSError>,
)
Available on crate feature WCSessionUserInfoTransfer only.
unsafe fn session_didFinishUserInfoTransfer_error( &self, session: &WCSession, user_info_transfer: &WCSessionUserInfoTransfer, error: Option<&NSError>, )
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.
Sourceunsafe fn session_didReceiveUserInfo(
&self,
session: &WCSession,
user_info: &NSDictionary<NSString, AnyObject>,
)
unsafe fn session_didReceiveUserInfo( &self, session: &WCSession, user_info: &NSDictionary<NSString, AnyObject>, )
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.
Sourceunsafe fn session_didFinishFileTransfer_error(
&self,
session: &WCSession,
file_transfer: &WCSessionFileTransfer,
error: Option<&NSError>,
)
Available on crate feature WCSessionFile only.
unsafe fn session_didFinishFileTransfer_error( &self, session: &WCSession, file_transfer: &WCSessionFileTransfer, error: Option<&NSError>, )
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.
Sourceunsafe fn session_didReceiveFile(
&self,
session: &WCSession,
file: &WCSessionFile,
)
Available on crate feature WCSessionFile only.
unsafe fn session_didReceiveFile( &self, session: &WCSession, file: &WCSessionFile, )
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.