Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Parse platform IOS SWIFT解析:Pfcloud.callFunction_Parse Platform_Push Notification_Back4app - Fatal编程技术网

Parse platform IOS SWIFT解析:Pfcloud.callFunction

Parse platform IOS SWIFT解析:Pfcloud.callFunction,parse-platform,push-notification,back4app,Parse Platform,Push Notification,Back4app,我在objective C中有一个旧应用程序,使用cloudcode将推送发送到back4app平台 应用程序将正确发送推送,代码如下: - (IBAction)inviaPush:(UIButton *)sender { NSString *canale; for (int i=0; i<=4; i++) { switch (i) { case 0:canale=@"TraduzioniEDI"; break;

我在objective C中有一个旧应用程序,使用cloudcode将推送发送到back4app平台

应用程序将正确发送推送,代码如下:

- (IBAction)inviaPush:(UIButton *)sender {
   NSString *canale;
   for (int i=0; i<=4; i++) {
       switch (i) {
           case 0:canale=@"TraduzioniEDI";
               break;
           case 1:canale=@"NavFtpYM";
               break;
           case 2:canale=@"InvioMailFTP";
               break;
           case 3:canale=@"VermasMto";
               break;
           case 4:canale=@"EdiAltova";
               break;
           default:
                break;
       }
       NSString *testoPush =[NSString stringWithFormat:@"%@ Test Invio %@",  canale,[NSDate date]];
        [PFCloud callFunctionInBackground:@"push"
                          withParameters:@{@"channels": @[canale], @"data": @{@"alert": testoPush,@"badge":@"Increment"}}
                                   block:^( NSString *result, NSError *error) {
                                       if (!error) {
                                           NSLog(@"Risultato: %@",result);
                                       } else{
                                           NSLog(@"Errore %@",error);
                                       }
                                   }];
   }
}
在这种情况下,我没有收到推送,在信息中我发现以下内容: 2020-03-02T01:17:25.505Z-未定义用户的Ran云功能推送: 输入:{“通道”:“NAVTPYM”,“数据”:{“警报”:“NAVTPYM测试因维”} 结果:“发送!!”

2020-03-02T01:17:25.504Z-无法计算PushStatus hm5hbCzDvd的安装数量:价值为$bad

比较仪表板中显示的信息,我发现输入存在差异

在目标C(工作)中,通道中的输入有一个方括号:

输入:{“通道”:[“VermasMto”]

当从swift发送时,它们没有

输入:{“通道”:“NAVTPYM”

当然,我调用方法PFCloud.callFunction的方式是错误的

有什么建议吗


法布里齐奥

解决方案很简单

需要改变

PFCloud.callFunction(inBackground: "push", withParameters: ["channels": canale, "data": ["alert": testoPush,"badge":"Increment"]], block: {

法布里齐奥

PFCloud.callFunction(inBackground: "push", withParameters: ["channels": canale, "data": ["alert": testoPush,"badge":"Increment"]], block: {
PFCloud.callFunction(inBackground: "push", withParameters: ["channels": [canale], "data": ["alert": testoPush,"badge":"Increment"]], block: {