Php APNSHPP-发送推送通知时出错

Php APNSHPP-发送推送通知时出错,php,ios,apple-push-notifications,apns-php,Php,Ios,Apple Push Notifications,Apns Php,我集成了用于发送推送通知的推送通知库。当我在本地机器上测试它时,它运行良好,但当我将库示例代码上载到live server时,它抛出了错误,我将响应粘贴到下面…我在整个响应中发现的真正错误是-->'错误:无法发送消息ID 1:缺少有效负载(4)'。我需要帮助来解决这个问题 Thu, 18 Apr 2013 12:58:29 +0200 ApnsPHP[17833]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195... Thu, 1

我集成了用于发送推送通知的推送通知库。当我在本地机器上测试它时,它运行良好,但当我将库示例代码上载到live server时,它抛出了错误,我将响应粘贴到下面…我在整个响应中发现的真正错误是-->'错误:无法发送消息ID 1:缺少有效负载(4)'。我需要帮助来解决这个问题

Thu, 18 Apr 2013 12:58:29 +0200 ApnsPHP[17833]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195... 
Thu, 18 Apr 2013 12:58:30 +0200 ApnsPHP[17833]: INFO: Connected to ssl://gateway.sandbox.push.apple.com:2195.
Thu, 18 Apr 2013 12:58:30 +0200 ApnsPHP[17833]: INFO: Sending messages queue, run #1: 1 message(s) left in queue. 
Thu, 18 Apr 2013 12:58:30 +0200 ApnsPHP[17833]: STATUS: Sending message ID 1 [custom identifier: Message-Badge-33] (1/3): 45 bytes. 
Thu, 18 Apr 2013 12:58:30 +0200 ApnsPHP[17833]: ERROR: Unable to send message ID 1: Missing payload (4). 
Thu, 18 Apr 2013 12:58:30 +0200 ApnsPHP[17833]: INFO: Disconnected. Thu, 18 Apr 2013 12:58:30 +0200 ApnsPHP[17833]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195... 
Thu, 18 Apr 2013 12:58:30 +0200 ApnsPHP[17833]: INFO: Connected to ssl://gateway.sandbox.push.apple.com:2195. 
Thu, 18 Apr 2013 12:58:30 +0200 ApnsPHP[17833]: INFO: Sending messages queue, run #2: 1 message(s) left in queue. 
Thu, 18 Apr 2013 12:58:30 +0200 ApnsPHP[17833]: WARNING: Message ID 1 [custom identifier: Message-Badge-33] has an unrecoverable error (4), removing from queue without retrying... 
Thu, 18 Apr 2013 12:58:31 +0200 ApnsPHP[17833]: INFO: Disconnected. 

array(1){[1]=>array(3)
{ 
[“消息”]=>对象(APNSHPU消息)#3(9)
{ 
[“\u bAutoAdjustLongPayload:protected”]=>bool(true)[“\u aDeviceTokens:protected”]=>array(1)
{ 
[0]=>字符串(64)“FB7B2A31F06532EAD2973C1512A27A4F48FE22D9AFB9EE9F33B566B73A768935”
} 
[“\u-sText:protected”]=>string(26)“Hello APNs启用设备!”[“\u-nBadge:protected”]=>int(3)[“\u-sSound:protected”]=>string(7)“默认”[“\u-bContentAvailable:protected”]=>NULL[“\u-aCustomProperties:protected”]=>array(2)
{ 
[“acme2”]=>array(2){[0]=>string(4)“bang”[1]=>string(4)“whiz”}
[“acme3”]=>array(2){[0]=>string(4)“bing”[1]=>string(4)“bong”}
}
[“\u nExpiryValue:protected”]=>int(30)[”\u mCustomIdentifier:protected”]=>string(16)“Message-Badge-33”
} 
[“二进制通知”]=>string(45)“Qoôôô{*1ð2Ò-array(1){[0]=>array(5){[“命令”]=>int(8)[“状态码”]=>int(4)[“标识符”]=>int(1)[“时间”=>int(1366282710)[“状态消息”]=>string(15)“缺少有效负载”
}
}
}
} 
提前谢谢


PS:google群组中也有人发布了相同的问题,但解决方案不可用。

经过一天的测试,我找到了问题所在:json_encode函数采用5.3 PHP版本中的第二个参数“options”:


在本地,我有PHPV5.3.x,因此代码在json_encode函数中的第二个参数下运行良好。但在live server上,PHP版本是5.2.6,因此json_encode代码中的第二个参数导致问题并抛出“丢失的负载”“错误。我刚刚删除了第2个参数,对我来说效果很好:)

经过一天的测试,我找到了问题所在:json_encode函数采用5.3 PHP版本中的第2个参数“选项”:


在本地,我有PHP V5.3.x,因此代码在json_encode函数中的第二个参数下运行良好。但在live server上,PHP版本是5.2.6,因此json_encode代码中的第二个参数导致问题并抛出“丢失的负载”错误。我刚刚删除了第二个参数,对我来说效果很好:)

谢谢@Deanna修复了格式…@Dave你知道这个错误吗?谢谢@Deanna修复了格式…@Dave你知道这个错误吗?幸运的是,我在调查同一个错误的十分钟内找到了你的答案。谢谢你的回答回答你的问题!对我来说完全是同一个问题。有了同样的问题,这工作非常完美。干杯!注意,事实上apns php明确要求php>=5.3。幸运的是,在调查相同错误的十分钟内,我找到了你的答案。感谢你回答你的问题!对我来说完全是同一个问题。有同样的问题,并且这非常有效。干杯!请注意,apns php实际上明确要求php>=5.3。
array(1) { [1]=> array(3) 
{ 
   ["MESSAGE"]=> object(ApnsPHP_Message)#3 (9) 
   { 
    ["_bAutoAdjustLongPayload:protected"]=> bool(true) ["_aDeviceTokens:protected"]=> array(1)
    { 
      [0]=> string(64) "FB7B2A31F06532EAD2973C1512A27A4F48FE22D9AFB9EE9F33B566B73A768935" 
    } 
   ["_sText:protected"]=> string(26) "Hello APNs-enabled device!" ["_nBadge:protected"]=> int(3) ["_sSound:protected"]=> string(7) "default" ["_bContentAvailable:protected"]=> NULL ["_aCustomProperties:protected"]=> array(2) 
  { 
    ["acme2"]=> array(2) { [0]=> string(4) "bang" [1]=> string(4) "whiz" } 
    ["acme3"]=> array(2) { [0]=> string(4) "bing" [1]=> string(4) "bong" } 
  }
  ["_nExpiryValue:protected"]=> int(30) ["_mCustomIdentifier:protected"]=> string(16) "Message-Badge-33" 
   } 
  ["BINARY_NOTIFICATION"]=> string(45) "QoÑô û{*1ðe2êÒ—<¢zOHþ"Ù¯¹îŸ3µf·:v‰5" ["ERRORS"]=> array(1) { [0]=> array(5) { ["command"]=> int(8) ["statusCode"]=> int(4) ["identifier"]=> int(1) ["time"]=> int(1366282710) ["statusMessage"]=> string(15) "Missing payload" 
   }
  }
 }
}