public interface NISessionDelegate
| Modifier and Type | Method and Description |
|---|---|
default void |
sessionDidGenerateShareableConfigurationDataForObject(NISession session,
NSData shareableConfigurationData,
NINearbyObject object)
Provides configuration data that needs to be shared with the accessory.
|
default void |
sessionDidInvalidateWithError(NISession session,
NSError error)
This is called when a session is invalidated.
|
default void |
sessionDidRemoveNearbyObjectsWithReason(NISession session,
NSArray<? extends NINearbyObject> nearbyObjects,
long reason)
This is called when the system is no longer attempting to interact with some nearby objects.
|
default void |
sessionDidUpdateNearbyObjects(NISession session,
NSArray<? extends NINearbyObject> nearbyObjects)
This is called when new updates about nearby objects are available.
|
default void |
sessionSuspensionEnded(NISession session)
This is called when a session may be resumed.
|
default void |
sessionWasSuspended(NISession session)
This is called when a session is suspended.
|
default void sessionDidGenerateShareableConfigurationDataForObject(NISession session, NSData shareableConfigurationData, NINearbyObject object)
After invoking this callback, the session will go into a special preparedness state for a limited amount of time. The interaction on the accessory must start within this time window. If activity is not detected from the accessory, the session will call the -[session:didRemoveNearbyObjects:reason:] delegate callback. To restart the session, coordinate with the accessory and call -[runWithConfiguration] again.
session - The session which produced the configuration data.shareableConfigurationData - The configuration data that needs to be shared with the accessory.object - A representation of the accessory as a NINearbyObject. The discoveryToken property will be equal to the one in the configuration used to run the session.default void sessionDidInvalidateWithError(NISession session, NSError error)
session - The session that has become invalid. Your app should discard any references it has to this session.error - The error indicating the reason for invalidation of the session (see NIError.h).default void sessionDidRemoveNearbyObjectsWithReason(NISession session, NSArray<? extends NINearbyObject> nearbyObjects, long reason)
The system was unable to interact with a peer device for some time, or the peer device signaled that it is leaving the session. After this callback is received, the session with the peer is no longer active. To retry interacting with the peer, issue a new call to -runWithConfiguration:.
session - The nearby interaction session that removed the nearby object(s).nearbyObjects - The nearby objects that were removed.reason - The reason the nearby object(s) were removed. All objects in nearbyObjects are removed for the same reason. If multiple nearby objects are removed for different reasons, -didRemoveNearbyObjects:reason: will be called multiple times.default void sessionDidUpdateNearbyObjects(NISession session, NSArray<? extends NINearbyObject> nearbyObjects)
session - The nearby interaction session being run.nearbyObjects - The nearby objects that have been updated.default void sessionSuspensionEnded(NISession session)
session - The nearby interaction session that was suspended.default void sessionWasSuspended(NISession session)
A session will be suspended in various app and system scenarios. A suspended session may be run again only after -sessionSuspensionEnded: has been called. Restart a session by issuing a new call to -runWithConfiguration:.
session - The nearby interaction session that was suspended.