我正在尝试从 PHP 向 Android 发送推送通知,我检查了我的项目号,API密钥和设备ID /设备令牌,所有凭据都正确,但是我出现以下错误:
UIBarButtonItem *donebutton=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(Btn_DoneClick)];
// donebutton.style=UIBarButtonItemStylePlain;
donebutton.tintColor = [UIColor blueColor];
这是我的代码:
{"multicast_id":7219223859365110681,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}
我的代码有什么问题?
答案 0 :(得分:0)
尝试更改此
$fields = array
(
'registration_ids' => $registrationIds,
'data' => $msg
);
到
$fields = array
(
'to' => 'XXXXXXXXXXX',//device token
'data'=> json_encode($msg)
);
还有这个
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
收件人:
$headers = array
(
'Authorization'=> 'key='. API_ACCESS_KEY,
'Content-Type'=> 'application/json'
);