是按照教程 http://blog.csdn.net/newjueqi/article/details/7898591 来做的。
注意事项:
1. 测试阶段使用的推送地址:
ssl://gateway.sandbox.push.apple.com:2195
正式上线使用的推送地址:
ssl://gateway.push.apple.com:2195
2.
那里给的php推送代码有问题,下面我贴出修改后推送成功的代码:
$message,'forum_id' => 88,'topic_id' => 999,);// encode the payload as json$payload = json_encode($body);// build the binary notification//$msg = chr(0).pack('n', 32).pack('h', $devicetoken). pack('n', strlen($payload)).$payload;$msg = chr(0) . pack(n,32) . pack('h*', str_replace(' ', '', $devicetoken)) . pack(n,strlen($payload)) . $payload;// send it to the server$result = fwrite($fp, $msg, strlen($msg));if (!$result){ echo 'message not delivered' . php_eol;}else{ echo 'message successfully delivered' . php_eol;}// close the connection to the serverfclose($fp);?>
[文章作者]曾健生
[作者邮箱]zengjiansheng1@126.com
[作者qq]190678908
[博客] http://blog.csdn.net/newjueqi
http://blog.sina.com.cn/h6k65
