Class DCDevice

  • All Implemented Interfaces:
    NSObject

    public class DCDevice
    extends NSObject
    A representation of a device that provides a unique, authenticated token. Use the shared instance of the `DCDevice` class to generate a token that identifies a device. Call the ``DeviceCheck/DCDevice/generateTokenWithCompletionHandler:`` method to get the token, and then send it to your server: ```swift if DCDevice.current.isSupported { // Always test for availability. DCDevice.current.generateToken { token, error in guard error == nil else { /* Handle the error. } // Send the token to your server. } } ``` On your server, combine the token with an authentication key that you obtain from Apple, and use the result to request access to two per-device binary digits (bits). After authenticating the device, Apple passes the current values of the bits, along with the date they were last modified, to your server. Your server applies its business logic to this information and communicates the results to your app. For more information about server-side procedures, see . - Note: To use the `DCDevice` class, your app must have an app ID that you register on the [Apple Developer](https://developer.apple.com/account/) website. Apple records the bits for you, and reports the bits back to you, but you’re responsible for keeping track of what the bits mean. You’re also responsible for determining when to reset the bits for a given device; for example, when a user sells the device to someone else. API-Since: 11.0
    • Constructor Detail

      • DCDevice

        protected DCDevice​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • alloc

        public static DCDevice alloc()
      • allocWithZone

        public static DCDevice allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • currentDevice

        @NotNull
        public static @NotNull DCDevice currentDevice()
        A representation of the device for which you want to query the two bits of data.
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • generateTokenWithCompletionHandler

        public void generateTokenWithCompletionHandler​(@NotNull
                                                       @NotNull DCDevice.Block_generateTokenWithCompletionHandler completion)
        Generates a token that identifies the current device. > Concurrency Note: You can call this method from synchronous code using a completion handler, > as shown on this page, or you can call it as an asynchronous method that has the > following declaration: > > ```swift > func generateToken() async throws -> Data > ``` > For example: > ```swift > let token = try await generateToken() > ``` > For information about concurrency and asynchronous code in Swift, see . Your server uses the generated token in its requests to get or set the persistent bits for the current device. You should treat the token you receive in the completion block as single-use. Although the token remains valid long enough for your server to retry a specific request if necessary, you should not use a token multiple times. Instead, use this method to generate a new token. - Note: The app you use to generate the token must be associated with your developer account; otherwise, the generation request fails. - Parameters: - completion: A completion block that includes the following parameters: - `token`: An ephemeral token that identifies the current device. - `error`: The error that occurred, if any.
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • isSupported

        public boolean isSupported()
        A Boolean value that indicates whether the device supports the DeviceCheck API.
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • new_objc

        public static DCDevice new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.