【发布时间】:2015-04-22 07:08:14
【问题描述】:
我正在使用 Amazon SNS 向我的 iOS 应用发送推送通知。
无论出于何种原因,我的端点有时似乎被设置为“假”——即使我知道它们是有效的端点(因为重新启用它们然后会向设备发送新的推送通知)。 There's a similar Stack Overflow question here - but no technical answer as to how to resolve the issue.
所以:我需要弄清楚如何将端点设置为enabled。
有only sparse Amazon documentation 说明如何做到这一点,所以我做知道我需要使用属性字典中的“启用”键/值。
我的 sn-p 代码如下所示:
AmazonSNSClient *sns = [AmazonClientManager sns];
SNSCreatePlatformEndpointRequest *endpointPutRequest = [SNSCreatePlatformEndpointRequest new];
endpointPutRequest.platformApplicationArn = kBXTAWSAppARN;
endpointPutRequest.token = deviceToken;
[endpointPutRequest setAttributesValue:@"True" forKey:@"Enabled"];
SNSCreatePlatformEndpointResponse *endpointResponse = [sns createPlatformEndpoint:endpointPutRequest];
这很好用,除了一行代码,它将属性值“启用”设置为“真”。我已经尝试了所有这些组合:
[endpointPutRequest setAttributesValue:@"true" forKey:@"Enabled"];
[endpointPutRequest setAttributesValue:@"true" forKey:@"enabled"];
[endpointPutRequest setAttributesValue:@"True" forKey:@"Enabled"];
...但它们都不起作用。编写这行代码的正确方法是什么?我应该以某种方式使用 BOOL 吗?整数?
【问题讨论】:
标签: ios amazon-web-services push-notification amazon-sns