AWS SNS推送通知在我的应用程序中不适用于android cloudwatch
,尽管相同的代码对IOS非常有用。我将delivered
用于跟踪错误,但在日志中显示状态为$platform = 1;
$token = 'user-device-token';
$gcmPlatformArn = 'AWS_GCM_ARN';
$ApnsPlatformArn = 'AWS_IOS_ARN';
$message = 'welcome';
$sns = SnsClient::factory([
'region' => 'my-region',
'version' => 'latest',
'credentials' => [
'key' => 'my-key',
'secret' => 'my-secret'
]
]);
if ($platform == 1) { //For Android
$endPointArn = $sns->createPlatformEndpoint([
'PlatformApplicationArn' => $gcmPlatformArn,
'Token' => $token
]);
} else {
$endPointArn = $sns->createPlatformEndpoint([
'PlatformApplicationArn' => $ApnsPlatformArn,
'Token' => $token
]);
}
$endPoint = $endPointArn['EndpointArn'];
return $sns->publish(['Message' => $message,
'TargetArn' => $endPoint]);
,但在设备中未收到推送通知。
相关应用代码
UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRect:cellimg.boundsbyRoundingCorners:(UIRectCornerBottomRight|UIRectCornerTopRight)cornerRadii:CGSizeMake(40.0, 40.0)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame =cellimg.bounds;
maskLayer.path = maskPath.CGPath;
cellimg.layer.mask = maskLayer;