第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

當應用程序在iOS中處于后臺模式時,無法接收GCM通知

當應用程序在iOS中處于后臺模式時,無法接收GCM通知

Qyouu 2019-12-06 12:47:55
我已經(jīng)在現(xiàn)有應用中配置了GCM,并且在那里收到了通知?,F(xiàn)在我面臨兩個問題:1)我退出應用程序時未收到通知,或者應用程序在后臺。2)我沒有在iPhone的通知區(qū)域中收到通知,僅當我的應用程序正在運行時,我才直接在該區(qū)域接收警報消息。當我下拉通知區(qū)域時,我在xcode的控制臺中收到此消息“無法連接到GCM:操作無法完成。(com.google.gcm錯誤2001。)”我的PHP文件在下面<?php// Payload data you want to send to iOSdevice(s)// (it will be accessible via intent extras)    $data = array( 'message' => 'Hello World!');// The recipient registration tokens for this notification// http://developer.android.com/google/gcm/ $ids = array( 'kucy6xoUmx********eeRsla' );// Send a GCM pushsendGoogleCloudMessage(  $data, $ids );function sendGoogleCloudMessage( $data, $ids ){    // Insert real GCM API key from Google APIs Console    // https://code.google.com/apis/console/            $apiKey = 'AIz******9JA';    // Define URL to GCM endpoint    $url = 'https://gcm-http.googleapis.com/gcm/send';    // Set GCM post variables (device IDs and push payload)         $post = array(                    'registration_ids'  => $ids,                    'data'              => $data,                                       );    // Set CURL request headers (authentication and type)           $headers = array(                         'Authorization: key=' . $apiKey,                        'Content-Type: application/json'                    );    // Initialize curl handle           $ch = curl_init();    // Set URL to GCM endpoint          curl_setopt( $ch, CURLOPT_URL, $url );    // Set request method to POST           curl_setopt( $ch, CURLOPT_POST, true );    // Set our custom headers           curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );    // Get the response back as string instead of printing it           curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );    // Set JSON post data    curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $post ) );    // Actually send the push       $result = curl_exec( $ch );    // Error handling    if ( curl_errno( $ch ) )    {        echo 'GCM error: ' . curl_error( $ch );    }?>
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 717 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號