Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

请问一下为什么ios有时候收不到消息,使用透传方式,即使收到也是弹窗,而不是通知栏信息 #5

Closed
zotopteam opened this issue Jan 16, 2018 · 11 comments

Comments

@zotopteam
Copy link

发送参数如下:

array:4 [▼
"template_data" => array:9 [▼
"title" => "中文"
"text" => "中文中文中文中文中文"
"is_ios" => true
"is_content_available" => true
"transmission_type" => 2
"badge" => 1
"sound" => "alert.wav"
"transmission_content" => "{"content":"\u4e2d\u6587\u4e2d\u6587\u4e2d\u6587\u4e2d\u6587\u4e2d\u6587","link":"harkhark://app/scenery/list"}"
"custom_msg" => array:1 [▼
"payload" => "{"content":"\u4e2d\u6587\u4e2d\u6587\u4e2d\u6587\u4e2d\u6587\u4e2d\u6587","link":"harkhark://app/scenery/list"}"
]
]
"template_type" => 4
"cid_list" => array:1 [▶]
]

@cncal
Copy link
Owner

cncal commented Jan 16, 2018

这只是 server 端的代码,推送成功还需要 client 端的支持。我现在手头没有现成的 ios app,所以没法帮你测试到底是什么问题,很抱歉!

@zotopteam
Copy link
Author

zotopteam commented Jan 16, 2018

首先感谢你的回复,然后问一下,ios推送你的这个包是可以支持的对吗,可以推送到通知栏?

@cncal
Copy link
Owner

cncal commented Jan 16, 2018

对的,之前也有朋友推送成功了的,我看到个推的 ios client 端 sdk 在上个月做了一次更新,不知道会不会有关系

@zotopteam
Copy link
Author

这样啊,那我们再调试一下,还有一点,ios使用透传的时候,需要传递category参数,在你的类(IGtAPNPayload.php)里面有这段

   if ($this->category != null && $this->category != "") {
                $apsMap["category"] = $this->category;
      }

但是前面却没法往里传递这个参数 ,请问我们有什么办法可以传递嘛

@zotopteam
Copy link
Author

另外,请问一下,这个有没有交流的QQ群,可以找用过的朋友咨询一下他们的使用经验?

@cncal
Copy link
Owner

cncal commented Jan 16, 2018

  • 不好意思,没有交流的QQ群
  • 关于 category,你需要
  1. 在入参 template_data 中添加 key: category 及其对应的 value;
  2. GetuiTemplate.phpIGtTransmissionTemplate 方法中,添加如下代码:
if (isset($sound)) {
     $apn->sound = $sound;
}
//  以下是添加的代码
if (isset($category)) {
    $apn->category= $category;
}
  • 如果就这个功能需要我去做 enhancement,迭代新的版本,请告诉我,我会尽快完成

@zotopteam
Copy link
Author

真的非常感谢,这个 $apn->category= $category; 传递是需要的,就是不想直接改源码,所以才问你有没有别的方式可以传递,如果方便,请及时迭代一下

@cncal
Copy link
Owner

cncal commented Jan 16, 2018

  • 我已经将版本更新到了 v0.1.1
  • 如果你们发现错误的原因在于此扩展包,请斧正,谢谢

@zotopteam
Copy link
Author

好的,谢谢你的帮助!非常感谢!

@zotopteam
Copy link
Author

调试安卓和ios均已经能正常发送信息,再次感谢你的帮助!

@cncal
Copy link
Owner

cncal commented Jan 18, 2018

那请问之前是因为什么调试失败的呢?以后如果有朋友遇到类似的问题,就有解决的方向了。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants