Skip to content

SafetyKit macOS xcode14.1 rc

Alex Soto edited this page Oct 18, 2022 · 1 revision

#SafetyKit.framework

diff -ruN /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAAuthorizationStatus.h /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAAuthorizationStatus.h
--- /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAAuthorizationStatus.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAAuthorizationStatus.h	2022-10-06 13:30:56.000000000 -0400
@@ -0,0 +1,30 @@
+//
+//  SAAuthorizationStatus.h
+//  SafetyKit
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/*
+ *  SAAuthorizationStatus
+ *
+ *  Discussion:
+ *      Represents the current motion authorization state.
+ *
+ *      SAAuthorizationStatusNotDetermined when the user has not been prompted yet.
+ *      SAAuthorizationStatusDenied when access is denied by the user.
+ *      SAAuthorizationStatusAuthorized when access is authorized by the user.
+ *
+ */
+API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos)
+typedef NS_ENUM(NSInteger, SAAuthorizationStatus) {
+    SAAuthorizationStatusNotDetermined = 0,
+    SAAuthorizationStatusDenied,
+    SAAuthorizationStatusAuthorized
+};
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SABase.h /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SABase.h
--- /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SABase.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SABase.h	2022-09-30 06:06:19.000000000 -0400
@@ -0,0 +1,17 @@
+//
+//  SABase.h
+//  SafetyKit
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#import <Availability.h>
+#import <os/availability.h>
+
+#ifdef __cplusplus
+#define SA_EXTERN extern "C" __attribute__((visibility("default")))
+#else
+#define SA_EXTERN extern __attribute__((visibility("default")))
+#endif
+
+#define SA_EXPORT __attribute__((visibility ("default")))
diff -ruN /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SACrashDetectionEvent.h /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SACrashDetectionEvent.h
--- /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SACrashDetectionEvent.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SACrashDetectionEvent.h	2022-10-06 13:30:56.000000000 -0400
@@ -0,0 +1,64 @@
+//
+//  SACrashDetectionEvent.h
+//  SafetyKit
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <CoreLocation/CLLocation.h>
+#import <SafetyKit/SABase.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * @brief This enumeration defines possible emergency responses to a crash event
+ * @sa SACrashDetectionEventResponse
+ */
+typedef NS_ENUM(NSInteger, SACrashDetectionEventResponse) {
+    SACrashDetectionEventResponseAttempted, ///< Emergency SOS response for the crash event was attempted
+    SACrashDetectionEventResponseDisabled, ///< Emergency SOS response for crash events is disabled
+} NS_SWIFT_NAME(SACrashDetectionEvent.Response) API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos);
+
+/**
+ * @brief This object describes a Crash Detection event and response to it.
+ * @sa SACrashDetectionEvent
+ */
+SA_EXTERN API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos)
+@interface SACrashDetectionEvent : NSObject<NSSecureCoding, NSCopying>
+
++ (instancetype)new NS_UNAVAILABLE;
+
+- (instancetype)init NS_UNAVAILABLE;
+
+/**
+ * date
+ *
+ * @discussion
+ * The time a crash was detected
+ */
+@property (nonatomic, readonly) NSDate *date;
+
+/**
+ * response
+ *
+ * @discussion
+ * enum value representing the emergency response to the Crash Detection event
+ *
+ * @sa SACrashDetectionEventResponse
+ */
+@property (nonatomic, readonly) SACrashDetectionEventResponse response;
+
+/**
+ * location
+ *
+ * @discussion
+ * Location information describing the geographical location of where the Crash Detection occurred.
+ *
+ *  @sa CLLocation
+ */
+@property (nonatomic, readonly, nullable) CLLocation *location;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SACrashDetectionManager.h /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SACrashDetectionManager.h
--- /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SACrashDetectionManager.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SACrashDetectionManager.h	2022-10-06 13:30:56.000000000 -0400
@@ -0,0 +1,96 @@
+//
+//  SACrashDetectionManager.h
+//  SafetyKit
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import <SafetyKit/SAAuthorizationStatus.h>
+#import <SafetyKit/SACrashDetectionEvent.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol SACrashDetectionDelegate;
+
+/**
+ * SACrashDetectionManager
+ *
+ * @discussion
+ * Use SACrashDetectionManager to receive information about Vehicular Crash Detection events.
+ * Not all phone models support Crash Detection, check for availability before creating an instance of SACrashDetectionManager.
+ * Set the delegate immediately after creating an instance of SACrashDetectionManager. Creating multiple instances of SACrashDetectionManager is not supported and should be avoided.
+ *
+ * SACrashDetectionManager requires an entitlement from Apple. To apply for the entitlement, see Crash Detection Entitlement Request.
+ */
+SA_EXTERN API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos)
+@interface SACrashDetectionManager : NSObject
+
+/**
+ * available
+ *
+ * @discussion
+ * Returns a  value indicating whether the current device supports Crash Detection.
+ */
+@property (class, nonatomic, readonly, getter=isAvailable) BOOL available;
+
+/**
+ * authorizationStatus
+ *
+ * @discussion
+ * Returns a value indicating whether the user has authorized the app to receive Crash Detection updates
+ */
+@property (nonatomic, readonly) SAAuthorizationStatus authorizationStatus;
+
+/**
+ * delegate
+ *
+ * @discussion
+ * The delegate object to receive Crash Detection events.
+ */
+@property (nonatomic, readwrite, weak) id<SACrashDetectionDelegate> delegate;
+
+/**
+ * @discussion
+ * Requests the user’s permission to access Crash Detection information.
+ *
+ * @param handler
+ * Completion handler invoked with the status of the authorization request.
+ */
+- (void)requestAuthorizationWithCompletionHandler:(void(^)(SAAuthorizationStatus status, NSError * _Nullable error))handler;
+
+@end
+
+/**
+ *  SACrashDetectionDelegate
+ *
+ *  @brief SACrashDetectionManager notifies its delegate about Crash Detection related information using this protocol.
+ *
+ *  @sa SACrashDetectionManager
+ */
+SA_EXTERN API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos)
+@protocol SACrashDetectionDelegate <NSObject>
+@optional
+
+/**
+ * @brief
+ * Update the delegate with a new Crash Detection event
+ *
+ * @discussion
+ * Crash Detection events may occur when the app is not running.
+ * Following a Crash Detection event, the system will launch the iOS app in the background giving it small amount of background execution time. This time should be used for critical tasks related to the Crash Event. For example: placing a network request or scheduling a local notification.
+ * In order to receive Crash Detection events, create a new SACrashDetectionManager instance and set its delegate early in the iOS app lifecycle (applicationDidFinishLaunching for example).
+ *
+ * If multiple Crash 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.
+ *
+ * Crash Detection events can be simulated with the iOS simulator. Use it to test the background functionality of your app.
+ */
+- (void)crashDetectionManager:(SACrashDetectionManager *)crashDetectionManager
+               didDetectEvent:(SACrashDetectionEvent *)event;
+
+ @end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAEmergencyResponseManager.h /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAEmergencyResponseManager.h
--- /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAEmergencyResponseManager.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAEmergencyResponseManager.h	2022-10-06 13:30:56.000000000 -0400
@@ -0,0 +1,95 @@
+
+//
+//  SAEmergencyResponseManager.h
+//  SafetyKit
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <SafetyKit/SABase.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol SAEmergencyResponseDelegate;
+
+/**
+ * @brief This enumeration defines the status of requested voice call
+ * @sa SAEmergencyResponseManagerVoiceCallStatus
+ */
+typedef NS_ENUM(NSInteger, SAEmergencyResponseManagerVoiceCallStatus) {
+    SAEmergencyResponseManagerVoiceCallStatusDialing, /// < the system is dialing the voice call
+    SAEmergencyResponseManagerVoiceCallStatusActive, /// < the system dialed voice call is connected and active
+    SAEmergencyResponseManagerVoiceCallStatusDisconnected, ///< the system dialed voice call is disconnected after being active
+    SAEmergencyResponseManagerVoiceCallStatusFailed, ///< the system dialed voice call failed to connect
+} NS_SWIFT_NAME(SAEmergencyResponseManager.VoiceCallStatus) API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos);
+
+
+/**
+ * SAEmergencyResponseManager
+
+ *
+ * @discussion
+ * Use SAEmergencyResponseManager to request actions in response to an emergency event.
+ * Set the delegate to monitor the progress of requested emergency response actions.
+ * SAEmergencyResponseManager requires user authorization for at least one of the emergency event detections e.g. SACrashDetectionEvent
+ *
+ * SAEmergencyResponseManager requires an entitlement from Apple to at least one of the emergency event detections. To apply for the entitlement, see respective detection mechanisms
+ */
+SA_EXTERN API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos)
+@interface SAEmergencyResponseManager : NSObject
+
+/**
+ * delegate
+ *
+ * @discussion
+ * The delegate object to receive updates about requested emergency response action.
+ */
+@property (nonatomic, readwrite, weak) id<SAEmergencyResponseDelegate> delegate;
+
+/**
+ * @discussion
+ * Requests the system to dial a voice call on behalf of the user.
+ * Apps running in the background / foreground can request to dial a voice call without user confirmation. Emergency numbers are not allowed.
+ * Requests are accepted only if user has authorized the app to receive and handle emergency detection events and only for a limited time after an emergency event is detected.
+ *
+ * @sa SAEmergencyResponseDelegate
+ *
+ * @param phoneNumber
+ * Apps can request the system to dial a voice call by providing a phone number. Emergency numbers are not allowed.
+ *
+ * @param handler
+ * Completion handler invoked with the status of the voice call request.
+ * If requested is accepted, the handler is invoked with a nil error. Interpret the error returned using SAErrorDomain.
+ * Requests will fail with SAErrorNotAuthorized if user has not authorized the app to receive and handle any emergency events.
+ * Requests will fail with SAErrorNotAvailable if invoked outside of the limited time window after an emergency event is detected.
+ * Use the SAEmergencyResponseDelegate to monitor the progress of the voice call.
+ */
+- (void)dialVoiceCallToPhoneNumber:(NSString *)phoneNumber
+                 completionHandler:(void(^)(BOOL requestAccepted, NSError * _Nullable error))handler;
+
+@end
+
+/**
+ * SAEmergencyResponseDelegate
+ *
+ * @brief
+ * SAEmergencyResponseManager notifies its delegate about status of the requested emergency response action
+ *
+ * @sa SAEmergencyResponseManager
+ */
+SA_EXTERN API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos)
+@protocol SAEmergencyResponseDelegate <NSObject>
+@optional
+
+/**
+ * @discussion
+ * Voice call can be requested when running in the foreground or background within a limited time window of a detected emergency event,
+ * Use this delegate to monitor the status of the requested voice call.
+ */
+- (void)emergencyResponseManager:(SAEmergencyResponseManager *)emergencyResponseManager
+        didUpdateVoiceCallStatus:(SAEmergencyResponseManagerVoiceCallStatus)voiceCallStatus NS_SWIFT_NAME(emergencyResponseManager(_:didUpdateVoiceCallStatus:));
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAError.h /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAError.h
--- /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAError.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SAError.h	2022-10-06 13:30:56.000000000 -0400
@@ -0,0 +1,29 @@
+//
+//  SAError.h
+//  SafetyKit
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+SA_EXTERN NSErrorDomain SAErrorDomain API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos);
+
+/*!
+ @enum      SAErrorCode
+
+ @constant  SAErrorNotAuthorized           The application is not authorized to perform the requested operation.
+ @constant  SAErrorNotAllowed          The API is restricted on this device at the current time.
+ @constant  SAErrorInvalidArgument         An invalid argument was provided to the API.
+ @constant  SAErrorOperationFailed         The requested operation failed, retrying may succeed.
+ */
+typedef NS_ERROR_ENUM(SAErrorDomain, SAErrorCode) {
+    SAErrorNotAuthorized = 1,
+    SAErrorNotAllowed,
+    SAErrorInvalidArgument,
+    SAErrorOperationFailed,
+} API_AVAILABLE(ios(16.0), macos(13.0), watchos(9.0)) API_UNAVAILABLE(tvos);
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SafetyKit.h /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SafetyKit.h
--- /Applications/Xcode_14.1.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SafetyKit.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.1.0-rc.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SafetyKit.framework/Headers/SafetyKit.h	2022-09-30 06:06:19.000000000 -0400
@@ -0,0 +1,19 @@
+//
+//  SafetyKit.h
+//  SafetyKit
+//
+//  Copyright © 2022 Apple Inc. All rights reserved.
+//
+
+#ifndef __SafetyKit__
+#define __SafetyKit__
+
+#import <SafetyKit/SABase.h>
+
+#import <SafetyKit/SAAuthorizationStatus.h>
+#import <SafetyKit/SACrashDetectionEvent.h>
+#import <SafetyKit/SACrashDetectionManager.h>
+#import <SafetyKit/SAEmergencyResponseManager.h>
+#import <SafetyKit/SAError.h>
+
+#endif /* __SafetyKit__ */
Clone this wiki locally