簡體   English   中英

AWS IOS IoT樣本MQTT連接失敗

[英]AWS IOS IoT sample MQTT connection failed

我一直在嘗試從https://github.com/awslabs/aws-sdk-ios-samples/tree/master/IoT-Sample/Swift運行AWS IOS IoT示例。 但是,當我在應用程序中單擊“連接”按鈕時,出現以下錯誤。 MQTT連接失敗。 我怎樣才能解決這個問題?

2019-08-20 20:19:29:065 IoTSampleSwift[87568:16809125] Attempting to 
reconnect.
connection status = 1
Connecting...
2019-08-20 20:19:29:065 IoTSampleSwift[87568:16809125] user metadata is : ?SDK=iOS&Version=2.10.2
2019-08-20 20:19:29:065 IoTSampleSwift[87568:16809125] Metrics collection is: Enabled
2019-08-20 20:19:29:066 IoTSampleSwift[87568:16809130] <<<NSThread: 0x6000029d2500>{number = 9, name = (null)}>> Initializing MQTTEncoder and MQTTDecoder streams
2019-08-20 20:19:29:066 IoTSampleSwift[87568:16809130] opening encoder stream.
2019-08-20 20:19:29:067 IoTSampleSwift[87568:16809130] opening decoder stream.
2019-08-20 20:19:29.067789-0700 IoTSampleSwift[87568:16809130] CFNetwork SSLHandshake failed (-9810)
2019-08-20 20:19:29.067943-0700 IoTSampleSwift[87568:16809130] TCP Conn 0x0 SSLHandshake failed (-9810)
2019-08-20 20:19:29:068 IoTSampleSwift[87568:16809130] MQTT session error, code: 3
2019-08-20 20:19:29:068 IoTSampleSwift[87568:16809130] closing encoder stream.
2019-08-20 20:19:29:068 IoTSampleSwift[87568:16809130] closing decoder stream.
2019-08-20 20:19:30:071 IoTSampleSwift[87568:16809130] MQTTSessionEventConnectionError: Received an MQTT session connection error
connection status = 5
Connection Error

我的物聯網政策如下所示:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "iot:*",
      "Resource": "*"
    }
  ]
}

我的Unauth Cognito角色如下所示:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "mobileanalytics:PutEvents",
                "cognito-sync:*",
                "cognito-identity:*",
                "dynamodb:*",
                "cloudwatch:*",
                "events:*",
                "iot:GetThingShadow",
                "iot:UpdateThingShadow",
                "iot:Subscribe",
                "iot:Connect",
                "iot:AttachPrincipalPolicy",
                "iot:CreateKeysAndCertificate",
                "iot:CreateCertificateFromCsr"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
2019-11-14 15:56:52:425 IoTSampleSwift[48745:446634] <<<NSThread: 0x60000351cc00>{number = 1, name = main}>>In    connectWithClientID
2019-11-14 15:56:52:425 IoTSampleSwift[48745:446634] hostName: (null)
2019-11-14 15:56:52:425 IoTSampleSwift[48745:446634] URL: a1hk3ctx3jrr2s-ats.iot.us-east-1.amazonaws.com
2019-11-14 15:56:52:433 IoTSampleSwift[48745:446634] user metadata is : ?SDK=iOS&Version=2.10.3
2019-11-14 15:56:52:433 IoTSampleSwift[48745:446634] Metrics collection is: Enabled
2019-11-14 15:56:52:434 IoTSampleSwift[48745:446634] -[AWSMQTTSession initWithClientId:userName:password:keepAlive:cleanSession:willTopic:willMsg:willQoS:willRetainFlag:publishRetryThrottle:] [Line 82], Thread:<NSThread: 0x60000351cc00>{number = 1, name = main} 
2019-11-14 15:56:52:434 IoTSampleSwift[48745:446634] +[AWSMQTTMessage connectMessageWithClientId:userName:password:keepAlive:cleanSession:willTopic:willMsg:willQoS:willRetain:] [Line 66], Thread:<NSThread: 0x60000351cc00>{number = 1, name = main} 
2019-11-14 15:56:52:434 IoTSampleSwift[48745:446634] Creating AWSMQTTMessage with raw data >>>>> <00044d51 54540482 012c0024 31373939 42354230 2d413232   462d3434 39322d39 3836452d 33353538 45383730 34453238 00173f53 444b3d69 4f532656 65727369 6f6e3d32 2e31302e 33> <<<<<
    connection status = 1
    Connecting...
2019-11-14 15:56:52:440 IoTSampleSwift[48745:448674] <<<NSThread: 0x6000035583c0>{number = 3, name = (null)}>> Initializing MQTTEncoder and MQTTDecoder   streams
2019-11-14 15:56:52:441 IoTSampleSwift[48745:448674] opening encoder stream.
2019-11-14 15:56:52:443 IoTSampleSwift[48745:448674] opening decoder stream.
2019-11-14 15:56:52.444986+0800 IoTSampleSwift[48745:448674] CFNetwork SSLHandshake failed (-9810)
2019-11-14 15:56:52.447134+0800 IoTSampleSwift[48745:448674] TCP Conn 0x0 SSLHandshake failed (-9810)
2019-11-14 15:56:52:449 IoTSampleSwift[48745:448674] MQTT session error, code: 3
2019-11-14 15:56:52:454 IoTSampleSwift[48745:448674] closing encoder stream.
2019-11-14 15:56:52:455 IoTSampleSwift[48745:448674] closing decoder stream.
2019-11-14 15:56:53:460 IoTSampleSwift[48745:448674] MQTTSessionEventConnectionError: Received an MQTT session connection error connection status = 5

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM