FCM responds {"readystate":0,"responsetext":"","status":0,"statustext":"error"}

62 views Asked by At

When sending a message with javascript FCM, {"readystate":0,"responsetext":"","status":0,"statustext":"error"} is returned by ajax .

Receiving is fine, and it works as intended in the IDE without any problems, but when I build it on iOS 15 16, I get {"readystate":0,"responsetext":"","status":0,"statustext":"error "} is returned. As far as I checked with the debug build, there was no difference in the Payload information between the IDE and the build, and I tried various things, but I couldn't find it. If you have any information, please let me know.

`

    $.ajax({
        url: 'https://fcm.googleapis.com/fcm/send',
        type: 'POST',
        headers : { Authorization : 'key='+'<key>'  },
        contentType : 'application/json',
        dataType: 'json',
        data: JSON.stringify({"to": "<token>", "notification": {"title":"Test","body":"Test"}}),
        timeout: 0,
        complete: function () {
            console.log('complete') ;
            },
        error: function(xhr, status, error) {
            console.log(xhr) ;
            console.log(status) ;
            console.log(error) ;
            },
        success: function(data){
            console.log(data) ;
            }
    });

`

I tried async: false, but there was almost no change , and as far as I checked with the debug build, there was no difference in Payload information between the IDE and the build

Build environment iOS6.2.0 Xcode13 CLI 11.0.0

1

There are 1 answers

0
長谷川洋平 On

I also tried rebuilding, but it didn't work. It was solved when I created an empty project and reassembled from init.