Recently the app can not receive notification, the android side works fine but the ios one has fail
so here is what I have attempt:
1) generate token
Create your APNs sandbox(development) certificate(make sure you are selecting bundle identifier of your development certificate)
Once you create sandbox certificate, verify push notification service is enabled for your provisioning profile(you can not create provisioning profile with your APNS certificate, you have to use your provisioning profile created with development certificate)
If you have already installed development provisioning profile then delete is from following path "xcode-prefrences-select apple developer account - view details - provisiong profile"
Download development provisioning profile from member center and install it. Select newly installed profile and certificate
Login to Amazon SNS and select nearest location(at top right corner) as shown in below image with red oval. Change Location place
Under "Mobile Services" section select SNS (Push Notification Service )
Now you will be at SNS Home Screen, now select Application from side Menu
Click on "Create Platform Application". Enter application name then select Push Notification Platform as "Apple Development" and Push Certificate type as "iOS Push Certificate"
Now you have to upload privateKey.p12
Process to get privateKey.p12
To get privateKey.p12, download APNs(sandbox) certificate and install it in krychain. then open keychain Access and expand certificate then select name of developer account holder(it will have icon of key and Kind as "private key") Now right click on account holder name and click on export(enter password to file if you want or else leave it blank) then name is as privatekey.p12 and store it on desktop
Choose privateKey.p12 from desktop then enter password if you have set then click on "Load Certificate from File" then certificate and private key fields will be populated with values exported from privateKey.p12.
Click on "Create Application Platform", your new ios Application is created.
Click on ARN, it will go inside your app. now click on "Create Platform Endpoint"
Run your mobile app and get deviceToken
Enter device token in "Device token" field and give device name in user data. Now click on "Add Endpoint"
Select added endpoint and click on "Publish to Endpoint"
Select message format as per your need then enter your message then click on "Publish Message".
If the SNS endpoint is disabled after a while, that means your APNS certificate has some issue. Do you mistakenly use a sandbox certificate for prod, or visa versa? Do you have the right certificate and private key combo? See http://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html for more information.
Make your Response as follow : if you're consuming from android use GCM or for ios use APNS_SANDBOX
$sns = AWS::createClient('sns');
$message = json_encode(['default' => '', 'APNS_SANDBOX' => json_encode($data), 'GCM' => json_encode(['data' => $data])]);
$sns->publish([
'TargetArn' => $arn,
'Message' => $message,
'MessageStructure' => 'json'
]);