Apns test with ad hoc provisioning - apple-push-notifications

I'm developing an App that works with Apple push notifications but I have some problems testing.
I have tested the app in the sandbox and it all works fine: it can send and receive push notifications, but for one single device (I think that is the correct behavior for an sandbox release).
But when I have create an ad hoc version with his production provisioning I have the same behavior: only one device works fine, it sends and receives the push, but the others devices do not receive any push. All devices can send a push but only the the first one can receive.
After installing 'PersistentConnectionLogging.mobileconfig' on devices that can't receive a push, I can read on the console:
Sep 7 13:17:51 unknown apsd[49] <Warning>: <APSCourier: 0x25a0a0>: Received message for enabled topic 'myapp.name' with payload '(null)'
Sep 7 13:17:51 unknown apsd[49] <Warning>: <APSCourier: 0x25a0a0>: Failed to parse JSON message payload for topic 'myapp.name': The operation couldn’-t -b-e -c-o-m-p-l-e-t-e-d-. -(-C-o-c-o-a -e-r-r-o-r -3-8-4-0-.-)
I can't resolve the issue, I have regenerated the provisioning profile many times and all work fine on server sides connections, the Apple feedback is OK.
I have checked my stored devices token and sandbox and production are different, any suggestions?

Amalgamation of comments posted as an answer, on request: (these helped to break the problem down and identify where the error was occuring)
How/where are you storing your device tokens? How are you generating the message to be pushed?
Your code that connects to the push servers and creates the payload... how is it sending to >1 devices?
I don't know the easyApns code, but either your other device tokens are invalid or the code is not looping correctly to push the message to the other devices. Also, have a browse through Google for the cocoa error 3840 and see if anything helps you to better understand the issue. Else pick some different push code, have a look at [link below] as a starting point.
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

Related

Microsoft Example 52 -

I managed to get Microsoft Example 52 to work last friday. But after the weekend (from 13. January on) I get the following error:
Error refreshing OpenId configuration:
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://login.botframework.com/v1/.well-known/openidconfiguration'.
at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync()
at Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.ValidateTokenAsync(String jwtToken, String channelId, String[] requiredEndorsements)
...
Error refreshing OpenId configuration: System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://login.botframework.com/v1/.well-known/openidconfiguration'.
---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://login.botframework.com/v1/.well-known/openidconfiguration'.
---> System.Net.Http.HttpRequestException: connection attempt failed because the remote peer did not respond properly after a certain period of time, or the established connection was faulty because the connected host did not respond.
---> System.Net.Sockets.SocketException (10060): A connection attempt failed because the remote terminal did not respond properly after a certain period of time, or the established connection was faulty because the connected host did not respond
-> By the way I translated the last two exceptions with deepl as they where in German
I already checked the forum and also documentation but with no luck.
Today I tried the example from scratch with different bot, different bot channels registration, and new copied example project but I still get the same error.
I still have to mention: The only difference to documentation is, that I registered bot and channel registration with another my azure user. And in teams I use an other account with office 365 business basic license. But last week it has worked - so maybe that's no problem at all!?!
Does anyone has an idea what to try next?
As per the comments above, this sounded like an issue with how the bot was hosted, and jwt validation code not being able to call out to the internet (e.g. a security or proxy setting). It needs to be able to physically call out to login.botframework.com/v1/.well-known/openidconfiguration . That might be fine on a local dev workstation, but blocked on an internal company server, for instance. In the end it was something in this line - proxy settings blocking the outgoing call, so listing it here as an answer for future visitors.

IPv6 support using Parse.com

My app was rejected today due to 'not supporting IPv6'. I've attached screenshots of the error they received which comes from a Parse.com API call.
I could really use some help on this, as I have no clue where to start with this.
Does anyone know if Parse.com supports IPv6? Or do I need to add something to my code? Do I need to migrate to Parse Server?
Please help =\
---- EDIT ---- 9/22/16
OK so, after my first rejection due to "IPv6" issues, I re-submitted and the app was approved. I'd still like to understand if Parse.com and Parse Server are officially IPv6 compatible but as for now, I'm just happy my app was approved. I'll keep this thread open and will edit it when I find the answer.
I have a parse server hosted on Heroku which doesn't support IPv6 yet (see here). But your server is not the reason why the app is rejected. It is your app which should support IPv6.
A possible solution is to download the latest Parse framework from https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/releases/tag/1.14.2 and replace the old ones. I think it should work.
Below is my comparison with the logs in the console for my app with the two different versions of Parse framework.
I have used Parse.framework and Bolts.framework from Feb 2016 in my Apple TV app and also just got rejected also for not supporting IPv6. I checked the log and found that
nw_resolver_start_crazy_eyeballs_timer Received IPv4 result first, performing crazy eyeballs: waiting 50ms on IPv6 for myapp.herokuapp.com:0.
__nw_resolver_start_crazy_eyeballs_timer_block_invoke Crazy eyeballs timer fired: did not receive IPv6 in time, reporting only IPv4 result for myapp.herokuapp.com:0
nw_resolver_cancel_crazy_eyeballs_timer Cancelling crazy eyeballs timer for myapp.herokuapp.com".
It seems the performance issue comes from the 50ms when the app loads.
I use the latest Parse framework and no "crazy_eyeballs_timer" shows up. The log seems more promising because I can see a IPv6 address in the log now.
nw_resolver_create_dns_service_on_queue Starting host resolution myapp.herokuapp.com:0, flags 0x4000d000
nw_resolver_host_resolve_callback flags=0x3 ifindex=0 error=NoSuchRecord(-65554) hostname=myapp.herokuapp.com. addr=0.0.0.0:0 ttl=60
nw_resolver_host_resolve_callback flags=0x2 ifindex=0 error=NoError(0) hostname=us-east-1-a.route.herokuapp.com. addr=88:ffff::bbbb:afb9.0 ttl=74
Here I changed the addr of my server in the log for security reason.
I will send a new update of my app to review and I believe that it should work. I will leave a comment when it gets accepted :)

Intermittent "Remote Server closed the connection before sending the response header" (iOS 8/network failure?)

I am debugging a very odd problem I noticed when testing in my own network. (It doesn't appear to happen on other servers outside my network) where random http requests fail.
I have tried it on two apache servers on my network, and it happens about 1 out of every 100 requests with 2 different apache servers.
I thought it was front-end related, but it appears something to do with my internal network OR configuration. I installed Charles proxy on my machine and used my phone to make the requests in the appellation. (Ajax)
The ajax/http request is being made but it is never making it into my access logs and I am getting the error "Remote Server closed the connection before sending the response header"
How can I debug this further?
NOTE: Also worth noting I can only reproduce problem on mobile iPhone + iPad devices when connecting to the server on the machine. (EVEN when using http proxy...which is very odd)
EDIT:
I did a wireshark capture for port 80 from the server computer and accessing it from iPhone. I am having a hard time interpreting it.
Here is the link to the capture files:
CAPTURE 1 (iOS 8 iPhone):
https://www.dropbox.com/s/1ipruv3wlmgng5o/http%20capture%20bad.pcapng?dl=0
NOTE: The error happens after the LAST post to sales/add_payment
CAPTURE 2 (iOS 8 iPhone):
https://www.dropbox.com/s/4zu3654uh9l6230/http%20capture%20bad%202.pcapng?dl=0
NOTE: The error happens after the LAST post to sales/complete
CAPTURE 3 (Android 4.4):
https://www.dropbox.com/s/8xtwkbewce02psw/http%20capture%20android%201.pcapng?dl=0
FOLLOW UP:
If it is indeed faulty network equipment, how do I determine what is bad? (device, router, modem?)

Suddenly Can Not Connect to APNS Sandbox Environment with PushSharp

We stopped being able to connect to the feedback.sandbox.push.apple.com about two days ago right in the middle of testing. I checked the certificate and it is valid. I also ran the openssl troubleshooting commands... and it all appeared ok. But we also can NOT doing any testing or work against the sandbox APNS. We are getting the following error about a malformed message response when we try and create the SSLStream connection. I have been scratching my head for a day now... thinking it was something on our end... so would really appreciate a response if others are able to test and connect to the sandbox APNS using PushSharp current version 2.1.2 ??
A call to SSPI failed, see Inner exception" Inner Exception -> "The message received was unexpected or badly formatted."
We were having the same issue using the now deprecated APNS-Sharp library (ancestor to PushSharp). I submitted a pull request for APNS-Sharp that fixes the issue based on my tests.
See https://stackoverflow.com/a/23121258/3542341
and for the pull request: https://github.com/Redth/PushSharp/pull/369/files

What to do with HTTP 412 (Precondition Failed) - The device is in an inactive state

I'm getting this error whenever I try to send a push notification to a Nokia WP7 device.
Other push URI's don't return this error but with this one, every try failed, even when the phone is "awake" and with wi-fi on.
Checking MSDN docs, I came to this:
http://msdn.microsoft.com/en-us/library/ff941100(v=vs.92).aspx
The device is in an inactive state. The web service may re-attempt sending the request one time per hour at maximum after receiving this error. If the web service violates the maximum of one re-attempt per hour, the Push Notification Service will de-register or permanently block the web service."
Which didn't help much, as all I can do is honor the "retry after 1 hour" and try to send again.
I suspect that it can be related to the device never had a SIM card in it and therefore could not "activate" but, if this is true, why does MSPN returned a push URI for the app?
Thanks in advance
I've noticed that Microsoft generates a new ChannelUri for a device often (in the past 2 days for my 2 devices i have 5 channel uris)
It may be that a new channeluri has been generated for the device.

Resources