Meaning Of Different Status Codes In APNS Error Response Packets - ios

APNS returns the following status codes in error response packets when using the enhanced notification format.
0 - No errors encountered
1 - Processing error
2 - Missing device token
3 - Missing topic
4 - Missing payload
5 - Invalid token size
6 - Invalid topic size
7 - Invalid payload size
8 - Invalid token
255 - None (unknown)
I want to know which of these status codes actually indicate that the issue is actually with the device token (ie: I can mark that particular device token in my database as invalid or inactive). I am sure that I can safely do that when I receive a value of 8 as status code. Also, I am pretty sure about what status codes 2, 4, 5 and 7 indicate and when exactly are they returned.
But for the rest of the status codes, I am pretty much in the dark. Apple's website does not contain much information about them either.
Can anybody please enlighten me about each of these status codes in detail. Many thanks in advance.

You're right about the 2, 4, 5, 7, and 8.
0 is good news obviously.
We're left with:
1 - Processing error
3 - Missing topic
6 - Invalid topic size
10 - Shutdown
255 - None (unknown)
1 is a problem on Apple's side, not related to the token.
3 is, according to Apple :
The topic is currently the bundle identifier of the target application on an iOS device.
6 is related to 3.
10 is out of your control but good to handle as well.
And obviously, 255 will not be able to help you define if the token is the problem.
If your goal is to determine a token that was valid at some point and no longer is, you should really refer to the Feedback Service API.

Related

QuickFIXJ 2.3 - onDisconnect(), onConnect()

I am using Quickfixj 2.3 for initiator. Vendor party is acceptor .
I have implemented SessionStateListener with the methods onConnectException and OnDisconnect.
I have resetOnLogon =Y in configuration file .
How can I catch specific exception like EndOfStream occurred ,due to wrong session data or due to acceptor allows only one session at a time or due to invalid Msg seq ?
Now, when the resetOnLogOn=Y,until the msgSeq satisfies, it keeps internally the disconnecting and initiating. I would like to logout manually in all other disconnects except this situation where it auto matches the seq number .
Thank you .
You actually cannot tell the scenarios listed in point 1 apart most of the time.
E.g. the counterparty normally will not tell you if you have wrong session data (I assume you mean wrong SenderCompID or TargetCompID) because that would disclose information about their system. Same goes for the duplicate session.
Only in the case of a "sequence number too low" event the counterparty normally will send this information in the 58/Text field of the Logout message.

Twitter stream APIs, allotted requests for search stream APIs v2

I'm new to Twitter APIs (this is my first experience), and I'm playing with them to monitor an account for new tweets, opening a web page when it happens, but I'm having some doubt on understanding how the allotting works.
Not knowing much, the twitter stream v2 APIs seem the ones fitting my use case, and in the Twitter-API-v2-sample-code git repository there is also a very clear filtered stream nodejs example. In fairness, I had little hassle to implement everything, and my code is not much different from filtered_stream.js source code. Given the provided example, implementation is straightforward: I use https://api.twitter.com/2/tweets/search/stream/rules to setup my rules (an array like [ { 'value': 'from:<myAccount>' } ] and then I start to listen at https://api.twitter.com/2/tweets/search/stream, easy peasy.
What I don't understand is the allotting resources count, because as per Twitter documentation I should be able to make 50 requests every 15 minutes, but I can barely make a couple, thus every time I'm testing my script I have to wait a couple of minutes before restarting.
These are the relevant headers I received after restarting a script running since one hour (the status code at restart was 429):
x-rate-limit-limit: 50
x-rate-limit-remaining: 49
Reset time: +15 minutes from current time
I usually don't have to wait 15 minutes, just a couple usually is fine... And my other note is that i managed to arrive down to 45 x-rate-limit-remaining once or twice, but never lower than that (usually I'm locked out at 47 / 48).
What I don't understand is: I opened one stream, I closed that one stream, and now I'm locked out for a couple of minutes. Allegedly, shouldn't I be able to open up to 50 connection in 15 minutes? (which is actually plenty if I'm just debugging a portion of code). Even the headers says that I have 49 attempts remaining out of 50, the status code 429 seems in pure contradiction with the x-rate-limits ... Sometimes, I cannot even reset the rules and start the stream in the same run, because the stream will return a backoff (status 429) when the rules resetting finishes (get -> set -> delete)...
I could add my code, but it's literally the NodeJS example I cited above, and my problem is not about querying the APIs, but rather not being able to connect for no apparent reason (at least to me). The only thing I could think of is the fact that I use the same Bearer for all requests (as per their example), but I don't see written anywhere it is a problem (I generated it in the developer dashboard, I'm not sure there is an API for that as well).
Edit - adding details
Just to describe my issue, this is the output I get when I start the script the first time:
Headers for stream received (status 200):
- [x-rate-limit-limit]: 50
- [x-rate-limit-remaining]: 49
- [x-rate-limit-reset]: 20/03/2021, 11:05:35
Which make sense, I made one request, remaining count went down by one.
Now, I stopped it, and ran it immediately after (Ctrl + C, run again, let's say two seconds delay), and this is the new output:
Headers for stream received (status 429):
- [x-rate-limit-limit]: 50
- [x-rate-limit-remaining]: 48
- [x-rate-limit-reset]: 20/03/2021, 11:05:35
With the following exception being returned in the body:
{
title: 'ConnectionException',
detail: 'This stream is currently at the maximum allowed connection limit.',
connection_issue: 'TooManyConnections',
type: 'https://api.twitter.com/2/problems/streaming-connection'
}
I understand the server takes a bit to realise I disconnected, but don't I have 50 connections available in a 15 minutes timeframe? I only opened one connection.
Actually, After the time it took to write all of the above (let's say ten minutes), I was able to connect again, receveing with this output:
Headers for stream received (status 200):
- [x-rate-limit-limit]: 50
- [x-rate-limit-remaining]: 47
- [x-rate-limit-reset]: 20/03/2021, 11:05:35
Maybe I'm realising only now and I wrote a useless question, but can I only have one active connection, being able to close it and open it again 50 times in 15 minutes? I understood I could have 50 active connections, but maybe at this point I'm wrong (and the Twitter server indeed takes a few minutes to realise I disconnected).

XCODE Console message Numbers between brackets correspondent with line code?

while running my iOS app i get the message:
2017-11-04 15:33:02.873595+0100 DagBoek[71486:4321269] ***
-[NSKeyedUnarchiver initForReadingWithData:]: data is NULL
in the XCODE console
DagBoek[71486:4321269] What do the numbers between the brackets mean ?
Can they help me to find where in my code the problem is ?
Thanks
No, they don't really help much. The first number, 71486 in your example, is the process ID (PID). The second number (4321269) is a thread ID of sorts, but Apple's diagnostic and debugging tools seem to use different thread ID schemes in different contexts, so it's mostly useless.

Got status code = 11 on APNS notification

I'm handling the error APNS send back after I write a notification.
According to the documentation, the error code should be 1-10 or 255.
Link: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html
However, I got the package back:
080b00000000
The command is 8 which fits the documentation but b = 11 which is not documented
Does anyone encounter this before as well?
Thank you!
It happens to me too.
My 'Notification identifier' item in the frame wasn't well formed.
The 'Item data length' must be the size of the binary version of your identifier.

Facebook Error Codes list?

Is there a place where I can find complete list of Facebook's error codes?
In my app's stats I have a few 1340004 errors:
Method: dialog:oauth:touch
Error Code: 1340004
Failures: 436
Sampled Method Calls: 1,172
Failure Rate: 37.2%
But what the hell IS that 1340004 error?? The answer is nowhere to be found, and FB's docs got only a small list of payment erros, which are 138**.
Where's the doc for ALL FB error codes?
Thanks.
I noticed that I have the same error:
Method: dialog:oauth:popup
Error Code: 1340004
Failures: 410
Sampled Method Calls: 816
Failure Rate: 50,2%
This data is from 2 days ago, yesterday I reduced Failure Rate to 1'1% and I think that I will not have any failure today. I had a lot of errors with tokens, since 2 days ago I receive longer access_tokens, and I had in my DB a short varchar field for this access_token and the result was truncated access_tokens.
I changed this field yesterday, I suspect that I reduced this error for my fix, but I'm not sure.

Resources