I'm using Amazon SNS to send push notifications to my iOS app.
For whatever reason, my endpoints occasionally seem to get set to "false" - even though I know that they are valid endpoints (because re-enabling them then delivers new push notifications to the device). There's a similar Stack Overflow question here - but no technical answer as to how to resolve the issue.
So: I need to figure out how to set the endpoint as enabled
.
There's only sparse Amazon documentation for how to do this, so what I do know is that I need to use the "enabled" key/value in the attributes dictionary.
My snippet of code looks like this:
AmazonSNSClient *sns = [AmazonClientManager sns];
SNSCreatePlatformEndpointRequest *endpointPutRequest = [SNSCreatePlatformEndpointRequest new];
endpointPutRequest.platformApplicationArn = kBXTAWSAppARN;
endpointPutRequest.token = deviceToken;
[endpointPutRequest setAttributesValue:@"True" forKey:@"Enabled"];
SNSCreatePlatformEndpointResponse *endpointResponse = [sns createPlatformEndpoint:endpointPutRequest];
This works perfectly, except for a single line of code, which sets the attributesValue "Enabled" to "true". I've tried all of these combinations:
[endpointPutRequest setAttributesValue:@"true" forKey:@"Enabled"];
[endpointPutRequest setAttributesValue:@"true" forKey:@"enabled"];
[endpointPutRequest setAttributesValue:@"True" forKey:@"Enabled"];
...yet none of them work. What is the proper way to write this line of code? Should I be using a BOOL somehow? An integer?