Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用iOS SDK重新启用Amazon SNS端点?_Ios_Amazon Web Services_Push Notification_Amazon Sns - Fatal编程技术网

如何使用iOS SDK重新启用Amazon SNS端点?

如何使用iOS SDK重新启用Amazon SNS端点?,ios,amazon-web-services,push-notification,amazon-sns,Ios,Amazon Web Services,Push Notification,Amazon Sns,我正在使用向我的iOS应用程序发送推送通知 无论出于何种原因,我的端点有时似乎被设置为“false”-即使我知道它们是有效的端点(因为重新启用它们会向设备发送新的推送通知) 因此:我需要弄清楚如何将端点设置为启用的 关于如何做到这一点,还有很多问题需要解决,所以我知道我需要使用属性字典中的“enabled”键/值 我的代码片段如下所示: AmazonSNSClient *sns = [AmazonClientManager sns]; SNSCreatePlatformEndpointRequ

我正在使用向我的iOS应用程序发送推送通知

无论出于何种原因,我的端点有时似乎被设置为“false”-即使我知道它们是有效的端点(因为重新启用它们会向设备发送新的推送通知)

因此:我需要弄清楚如何将端点设置为启用的

关于如何做到这一点,还有很多问题需要解决,所以我知道我需要使用属性字典中的“enabled”键/值

我的代码片段如下所示:

AmazonSNSClient *sns = [AmazonClientManager sns];

SNSCreatePlatformEndpointRequest *endpointPutRequest = [SNSCreatePlatformEndpointRequest new];
endpointPutRequest.platformApplicationArn = kBXTAWSAppARN;
endpointPutRequest.token = deviceToken;
[endpointPutRequest setAttributesValue:@"True" forKey:@"Enabled"];

SNSCreatePlatformEndpointResponse *endpointResponse = [sns createPlatformEndpoint:endpointPutRequest];
除了一行代码将attributesValue“Enabled”设置为“true”之外,这一操作非常有效。我尝试了所有这些组合:

[endpointPutRequest setAttributesValue:@"true" forKey:@"Enabled"];
[endpointPutRequest setAttributesValue:@"true" forKey:@"enabled"];
[endpointPutRequest setAttributesValue:@"True" forKey:@"Enabled"];

……但它们都不起作用。写这行代码的正确方法是什么?我应该怎么用枪吗?整数?

到目前为止,我发现了一些条件,即即使端点和标记是正确的,端点属性也会变为false

  • 如果您已经创建了带有生产APNS证书的amazon sns应用程序,但您尝试使用沙盒APNS(即开发APNS)注册您的设备,那么它将变为false

  • 当用户在手机设置中关闭通知时,苹果APNS会禁用该标志,这也会影响亚马逊sns。每当用户再次启用通知时,您已将令牌重新发送到amazon以设置属性true,即需要在客户端处理

  • 当用户删除/卸载应用程序时


  • 我正在使用PHPSDK,但遇到了相同的错误。我找到的唯一解决方案是首先调用不带Enabled属性的“createPlatformEndpoint”方法,然后调用“setEndpointAttributes”方法将端点的Enabled标志设置为true。

    根据重新启用端点时的提示“…您确实需要更新令牌,然后才能在端点上设置Enabled”.

    这可以通过两个单独的调用来完成:创建/更新令牌,然后将“启用””设置为“真”


    通过SNS控制台手动禁用端点,然后重新注册设备并使用上述两个调用来测试这一点

    谢谢你的链接。尽管亚马逊表示您需要“更新”代币,但只有在苹果提供新代币的情况下,这才有意义。苹果的同一应用程序的大多数重新安装都给了我相同的令牌,这让我根本无法使用该设备进行通知。