laravel jpush

composer require jpush/jpush

新建 config/jpush.php 文件

<?php
return [
    'appKey' =>env('JPUSH_APP_KEY', 'AppKey'),
    'masterSecret' =>env('JPUSH_MASTER_SECRET', 'Master Secret')
];

php artisan make:controller JPushController –resource

Route::resource(‘jpush’, ‘JPushController’);

use JPush\Client as JPush;

$jpush = new JPush(config(‘jpush.appKey’), config(‘jpush.masterSecret’));
$response = $jpush->push()
->setPlatform(‘all’)
->addRegistrationId(‘190e35f7e0007dd42b0’)
->setNotificationAlert(‘hello tp3.2’)
->options([‘apns_production’=>true])//这句很重要,开发和生产版本通知切换,之前遇的坑。
->send();
print_r($response);

问题:laravel ios jpush 无法收到推送,web端正常,api不成功。

options 的 apns_production 要为true。见上方代码。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注