Amazon sns (push notification) does not send to IOS application

前端 未结 3 1908
臣服心动
臣服心动 2021-01-13 17:43

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         


        
相关标签:
3条回答
  • 2021-01-13 18:24
    1. Create your APNs sandbox(development) certificate(make sure you are selecting bundle identifier of your development certificate)

    2. 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)

    3. If you have already installed development provisioning profile then delete is from following path "xcode-prefrences-select apple developer account - view details - provisiong profile"

    4. Download development provisioning profile from member center and install it. Select newly installed profile and certificate

    5. Login to Amazon SNS and select nearest location(at top right corner) as shown in below image with red oval. Change Location place

    6. Under "Mobile Services" section select SNS (Push Notification Service )

    7. Now you will be at SNS Home Screen, now select Application from side Menu

    8. Click on "Create Platform Application". Enter application name then select Push Notification Platform as "Apple Development" and Push Certificate type as "iOS Push Certificate"

    9. 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

    1. 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.

    2. Click on "Create Application Platform", your new ios Application is created.

    3. Click on ARN, it will go inside your app. now click on "Create Platform Endpoint"

    4. Run your mobile app and get deviceToken

    5. Enter device token in "Device token" field and give device name in user data. Now click on "Add Endpoint"

    6. 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".

    0 讨论(0)
  • 2021-01-13 18:30

    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.

    0 讨论(0)
  • 2021-01-13 18:32

    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'
        ]);
    
    0 讨论(0)
提交回复
热议问题