requestAuthorization(forPhoneNumber:completion:)
Presents a prompt that asks the person to allow cellular plan checks for their phone number.
Declaration
class func requestAuthorization(forPhoneNumber phoneNumber: String, completion completionHandler: @escaping @Sendable (CTCellularPlanStatusAuthorization, (any Error)?) -> Void)class func requestAuthorization(forPhoneNumber phoneNumber: String) async throws -> CTCellularPlanStatusAuthorizationParameters
- phoneNumber:
A phone number in T REC E (for example,
+15550001234). - completionHandler:
A closure the framework calls with the authorization result and any error that occurs.
Discussion
The completion handler receives a CTCellularPlanStatusAuthorization value in the following circumstances:
- CTCellularPlanStatusAuthorization.authorized
The person grants permission.
- CTCellularPlanStatusAuthorization.notAuthorized
The person denies permission.
- CTCellularPlanStatusAuthorization.restricted
Cellular plan checks aren’t available for the given number.
Only call getHintForPhoneNumber(_:completion:) after receiving an CTCellularPlanStatusAuthorization.authorized result.