Apple Push Notification Limitations

I am developing an iOS application that uses push notifications, I have implemented the application and the server side, and it works fine if I send only one or two notifications. The problem arises when I need to send the same notification to all my users, notifications only reach the first users of the cycle. I am in the sandbox, so I wonder if there is a restriction on the sandbox environment, because I read that the APNS service has no restrictions. Any idea?

Thanks in advance,

UPDATED DECISION:

I had to check the response to the apple, I sent push to notful tokens, and Apple disconnected me from the server. With the following function, I solved the problem. Thanks @Eran and this post

/* FUNCTION to check if there is an error response from Apple * Returns TRUE if there was and FALSE if there was not */ public function checkAppleErrorResponse($fp) { //byte1=always 8, byte2=StatusCode, bytes3,4,5,6=identifier(rowID). // Should return nothing if OK. //NOTE: Make sure you set stream_set_blocking($fp, 0) or else fread will pause your script and wait // forever when there is no response to be sent. $apple_error_response = fread($fp, 6); if ($apple_error_response) { // unpack the error response (first byte 'command" should always be 8) $error_response = unpack('Ccommand/Cstatus_code/Nidentifier', $apple_error_response); if ($error_response['status_code'] == '0') { $error_response['status_code'] = '0-No errors encountered'; } else if ($error_response['status_code'] == '1') { $error_response['status_code'] = '1-Processing error'; } else if ($error_response['status_code'] == '2') { $error_response['status_code'] = '2-Missing device token'; } else if ($error_response['status_code'] == '3') { $error_response['status_code'] = '3-Missing topic'; } else if ($error_response['status_code'] == '4') { $error_response['status_code'] = '4-Missing payload'; } else if ($error_response['status_code'] == '5') { $error_response['status_code'] = '5-Invalid token size'; } else if ($error_response['status_code'] == '6') { $error_response['status_code'] = '6-Invalid topic size'; } else if ($error_response['status_code'] == '7') { $error_response['status_code'] = '7-Invalid payload size'; } else if ($error_response['status_code'] == '8') { $error_response['status_code'] = '8-Invalid token'; } else if ($error_response['status_code'] == '255') { $error_response['status_code'] = '255-None (unknown)'; } else { $error_response['status_code'] = $error_response['status_code'].'-Not listed'; } echo '<br><b>+ + + + + + ERROR</b> Response Command:<b>' . $error_response['command'] . '</b>&nbsp;&nbsp;&nbsp;Identifier:<b>' . $error_response['identifier'] . '</b>&nbsp;&nbsp;&nbsp;Status:<b>' . $error_response['status_code'] . '</b><br>'; echo 'Identifier is the rowID (index) in the database that caused the problem, and Apple will disconnect you from server. To continue sending Push Notifications, just start at the next rowID after this Identifier.<br>'; return true; } return false; } 
+4
source share
3 answers

The likely problem is that some of the device tokens that you use are invalid (remember that production device tokens are not valid in the sandbox environment and vice versa). Sending a notification to an invalid device token will close your socket on APN servers. All notifications written to this socket after the invalid will be discarded until you open a new socket.

You can try reading Apple's error responses to find out which device token is incorrect.

You should definitely read the Technical Note error checking section that has already been mentioned by other people here.

+9
source

You might need to check this out :

There are no restrictions on cache size or batch size for using APN. An iOS 6.1 press release said APN has sent over 4 trillion push since its inception. It was announced at WWDC 2012 that APN sends 7 billion notifications daily.

If you see a bandwidth of less than 9000 notifications per second, your server can take advantage of improved logic error handling.

0
source

There is no limit to the number of users you can send, you just need to make sure that the size of the message sent to them is below this limit, which, according to Kirti, is about 2048 bytes.

There is also no restriction on how often you can send messages, but I would not recommend sending messages too often.

0
source

Source: https://habr.com/ru/post/1491872/


All Articles