简体   繁体   English

解析:如何从iOS应用向所有人发送推送通知?

[英]Parse : How to send a push notification to everyone from iOS app?

is there a way to send a push notification to everyone directly from app, as in the console ? 有没有办法像在控制台中那样直接从应用程序向所有人发送推送通知? if i try following code : 如果我尝试以下代码:

PFPush *push = [[PFPush alloc] init];
[push setMessage:@"Invio Push"];
[push sendPushInBackground];

looking at the consolle it says that has been sent to 0 users,and it tried to send to channels i/o everyone. 看到慰问说它已经发送给0个用户,并试图发送给每个人的频道。 If i send the message from console, i manage to send to everyone, without problem Is there a way to achieve the same results from app ? 如果我从控制台发送消息,则可以毫无问题地发送给所有人。有没有办法从应用程序获得相同的结果?

Ps naturally if I add 我自然会加Ps

PFPush *push = [[PFPush alloc] init];
[push setChannel:@"Mychannel"];
[push setMessage:@"Invio Push"];
[push sendPushInBackground];

the push notification is sent correctly to "Mychannel" channel 推送通知已正确发送到“ Mychannel”频道

Many thanks Fabrizio 非常感谢Fabrizio

Yes you can also send push notifications directly from a mobile application. 是的,您还可以直接从移动应用程序发送推送通知。 Remember that you need to have enabled this feature in the Parse app's settings tab by selecting "Yes" under the heading "Client push enabled?". 请记住,您需要通过在“启用客户端推送?”标题下选择“是”,才能在“解析”应用程序的“设置”标签中启用此功能。 There are several methods that can be called to send push notifications. 可以调用多种方法来发送推送通知。

My Example: 我的例子:

// Create our Installation query
PFQuery *pushQuery = [PFInstallation query];
[pushQuery whereKey:@"deviceType" equalTo:@"ios"];

// Send push notification to query
[PFPush sendPushMessageToQueryInBackground:pushQuery 
                               withMessage:@"TEST1234"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM