首页 > 解决方案 > SQRDReaderSDK.shared.authorize() 最初没有回调

问题描述

我目前无法使用 iOS (Swift) 授权 SquareReaserSDK。

  1. 我有一个接受access_token的节点实例。
  2. 然后我调用listLocations()
  3. 我在CreateMobileAuthorizationCodeRequest()的正文中提供了第一个location_id
  4. 然后我将生成的移动身份验证代码传递给客户端

在成功检索移动身份验证令牌并将其提供给下面之后,第一次调用它时没有回调。块 if 语句永远不会触发。

冗余调用会导致authorization_already_in_progress错误(触发 if 语句)。

SQRDReaderSDK.shared.authorize(withCode: mobileAuthToken) { location, error in

        if let authError = error {
             print("Authorize SquareReaderSDK", authError.localizedDescription)
        } else {
             print("Authorize SquareReaderSDK", location)
             Defaults[.establishment]?.squareMobileAuthToken = mobileAuthToken as! String
        }
}


authorize() 端点参考: https ://developer.squareup.com/docs/api/reader/ios/Classes/SQRDReaderSDK.html#/Authorization


冗余调用导致:

vvvvv SQUARE ERROR vvvvv

ERROR: Something went wrong. Please contact the developer of this application and provide them with this error code: authorization_already_in_progress
DEBUG CODE: authorization_already_in_progress
DEBUG MESSAGE: Authorization is already in progress. Please wait for SQRDReaderSDK.shared.authorize() to complete.

^^^^^ SQUARE ERROR ^^^^^


在尝试授权设备的任何时候,我在尝试呈现 checkoutController 时都会收到以下错误:

Checkout Failed:
    This device is not currently authorized to accept payments with Square.

标签: iosnode.jsswiftsquare-connectsquare

解决方案


推荐阅读