推送通知中的错误

时间:2014-06-05 09:01:20

标签: php urbanairship.com

我正在尝试实施城市飞艇,并从简单的PHP代码开始。但是给了我错误。 我的PHP代码:

<?php
require_once 'vendor/autoload.php';
use UrbanAirship\Airship;
use UrbanAirship\Push as P;

$airship = new Airship("key", "secret");
$response = $airship->push()
    ->setAudience(P\deviceToken(""))
    ->setNotification(P\notification("Hello from php!"))
    ->setDeviceTypes(P\all)
    ->send();

print "Push sent!. Push IDs:" . $response.push_ids;

错误: 致命错误:在C:\ xampp \ htdocs \ phpProjects \ notify \ vendor \ urbanairship \ urbanairship \ src \ UrbanAirship \ AirshipException中显示消息'UrbanAirship \ AirshipException',消息'飞艇请求失败:401发送到https://go.urbanairship.com/api/push/' .php:17堆栈跟踪:#0

1 个答案:

答案 0 :(得分:0)

错误是因为在制作飞艇对象时没有给出keysecret。提供密钥和秘密后,问题得以解决