菜鸟教程小白 发表于 2022-12-12 12:48:33

ios - Azure 通知中心 : APNS dictionary not being sent.


                                            <p><p>我对 Azure 通知中心比较陌生。当我发送一个像这样形成的 JSON 对象时,我的系统正在工作。 </p>

<pre><code>{&#34;aps&#34;: {&#34;alert&#34; : &#34;hello&#34;}}
</code></pre>

<p>但是当我像下面这样发送有效负载时,Azure 在其调试控制台中显示成功,但它从未到达我的移动设备。 </p>

<pre><code>{&#34;aps&#34;: {&#34;alert&#34; : {&#34;msg&#34;:&#34;hello&#34;}}}
</code></pre>

<p>区别显然是字符串与对象。 <a href="https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html" rel="noreferrer noopener nofollow">APNS documentation</a>表明我应该能够发送字符串或字典。 </p>

<p>还有其他人看到过这种行为吗?无论如何要修复它?我真的希望能够发送一个对象,而不是必须在客户端解析字符串。 </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>找到我自己的答案。我很愚蠢,没有更仔细地阅读文档。问题是字典需要某些键。以下有效载荷将起作用。 </p>

<pre><code>{&#34;aps&#34;: {&#34;alert&#34; : {&#34;body&#34;:&#34;hello&#34;}}}
</code></pre>

<p> <img src="/image/Zdhzv.png" alt="enter image description here"/> </p>

<p>我错过了字典需要某些键。文档指定了 body、action-loc-key、loc-key、loc-args、launch-image。这是文档的屏幕截图。 </p>

<p> <img src="/image/5lZ0c.png" alt="enter image description here"/> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - Azure 通知中心 : APNS dictionary not being sent.,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/26978892/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/26978892/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - Azure 通知中心 : APNS dictionary not being sent.