I've been testing my iPad app with ad-hoc distributions.
On our server (running Windows Server 2008) APNS alerts come through fine.
On the ec2 (also running Windows Server 2008) they never arrive.
The only difference between the two ad-hoc versions is the server they point to. Both have the same code-signing settings.
I followed the same procedure for importing certificates on both servers and as far I can tell the certificates are exactly the same on both servers.
I've also opened ports 5223, 2196, 2195 & 443 and allowed the 17.0.0.0/8 address block:
I even tried turning off the Firewall but no joy and I still can't figure out why it works on one but not the other.
Anyone have any ideas?
-EDIT-
I'm using MoonAPNS to handle sending the notifications via a C# / ASP.Net web service. Don't know if that makes any difference.
Push notifications with EC2 work great. Used/implemented it in a couple of apps. Here's a couple of things to check
Do you get an error when connecting to the APN servers? Try using $ telnet gateway.push.apple.com 2195. Does it work? In case it doesn't you might need to make changes to the security group/open the necessary ports
If the server says the message was sent successfully, but you don't receive it in the app, make sure you check the mobileprovision and pem files you are using
Since you mention telnet works and you have checked the pem and mobileprovisions, a few other things to check
Do you get any errors when MoonAPNS tries connecting to the APN servers?
If no errors are returned, did you check if the device tokens were stored in your database and it was your test device's token?
If messages are being sent out ok, did you ping feedback services? Do they return an error for a specific device token (i.e. your device)?
It turned out to be nothing specifically to do with the Amazon ec2 but rather something that not only should've been obvious but that I've also had an issue with before.
I'm using MoonAPNS and the problem was the first parameter in this line:
PushNotification push = new PushNotification(true, certificate, password);
The true parameter tells MoonAPNS to send the notification to Apple's sandbox server.
false tells it to send to the production server.
I had false on our own server and true on the Amazon ec2.
Both are now false and the notifications are at last coming through from the ec2.
Thanks to everyone for your efforts.
Related
I am using PushSharp to send push notifications and getting the error 'The maximum number of Send attempts to send the notification was reached!'.
The interesting thing is that from my local server notifications are sent successfully, but when I run on Client Server I am getting above error.
At the this link https://github.com/Redth/PushSharp/issues/462, I see you resolved this issue. with the following tricks.
Exported Apple Developer & Distribution Certificates as *.p12 from Keychain of Mac (No Private Keys)
Added the certificates to the windows keychain of server under personal & trusted roots to match the certs being loaded for the push channel settings
Extended the max re queue property value of service settings to 25, the default is 5
I follow the above, but still issue persists. Any Idea or another way to resolve it ?
I have problem on Apple push notification in my backend. All my device tokens were stored in my database either development and production. During I push message to APNs, I got invalid device token message and the connection is closed. The push notification operation is never completed. Would you mind giving me the solution to identify if it's development or production device token?
The root of your problem sounds like you're sometimes using the wrong certificate for the token - dev cert with production token etc.
Announced by Apple today that you now only need one certificate for both environments. This would mean that you're always using the correct certificate for your tokens, and might therefore fix your problem.
Obviously, as has already been stated, you need to keep your dev/production environments separate (or at least mark records as coming from one particular environment).
Hope this helps.
The device token generated is decided by operating system and hence its random. We cant identify the device token environment.
We are working with IBM MobileFirst Platform 7.0 and are trying to send push notifications through the Apple APNS server. We are not using a SOCKS proxy.
As far as we know, we have opened the relevant ports through an F5 load balancer from the MFP server(s) to the internet:
gateway.sandbox.push.apple.com:2195
feedback.sandbox.push.apple.com:2196
gateway.push.apple.com:2195
feedback.push.apple.com:2196
However, we are still seeing tracing errors when sending push notifications of this form:
[10/22/15 9:43:01:362 CEST] 00000153 ApnsConnectio I com.ibm.pushworks.server.notification.apns.ApnsConnectionImpl sendMessage Failed to send message Message(Id=7; Token=XXX; Payload={"aps":{"alert":{"body":"Test body","action-loc-key":null}},"payload":"{\"id\":\"XXX\",\"title\":\"Test body\",\"tag\":\"Push.ALL\"}"})... trying again after delay
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:208)
at java.net.SocketInputStream.read(SocketInputStream.java:134)
at com.ibm.jsse2.a.a(a.java:260)
at com.ibm.jsse2.a.a(a.java:204)
at com.ibm.jsse2.aq.a(aq.java:684)
at com.ibm.jsse2.aq.h(aq.java:790)
at com.ibm.jsse2.aq.a(aq.java:371)
at com.ibm.jsse2.h.write(h.java:20)
at java.io.OutputStream.write(OutputStream.java:87)
at com.ibm.pushworks.server.notification.apns.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:302)
at com.ibm.pushworks.server.notification.apns.ApnsConnectionImpl.sendMessage(ApnsConnectionImpl.java:292)
(I have redacted the token and the Id).
I would theorise that the network connectivity is not set up quite correctly, but it is possible to telnet to each of the above addresses on the above ports from the MFP server, so on a superficial level, connectivity seems to be working.
Is there a way we can verify more deeply whether we have sufficient network connectivity to those servers to send push notifications, ideally independently of MobileFirst? I understand a persistent connection is required ("...The provider connects with APNs through a persistent and secure channel..."), and perhaps this is where things are not set up correctly.
My answer would be a continuation of the answer to your other push-related question: Is 1-courier.push.apple.com needed for IBM MobileFirst APNS notifications? What is it for?
Did you try to also allow access for 1-courier.push.apple.com:5223 and observed if things do start working now? I think you should allow it.
I have a project where I need to be able to send messages from a server running a web service to a specific iDevice. I have no idea how to do this, so any help is very appreciated.
The scenario: I have a web service which receives some message from an iDevice (could also be a Mac or PC, even an Android device). Depending on the content of this message I need to be able to send a message from the web service to another iDevice (I know the IP-address of the specific iDevice). I know how to use URLRequests to send a message from an iDevice to a server and collect the response from the server. In principle I could every 10 seconds send a request to the server asking if the server has any new messages to the sender (the iDevice sending the request), but I am pretty sure this is not the correct way to do it. Is there a way to have an iDevice listen for server communication on a specific port, so that the iDevice only does something active when it receives a message from the server to do something, e.g. display a message in the app listening for the server communication?
I guess I need to use something similar to the technology used for iMessage, but how is this done?
I am using XCode 4.6.2, iOS 6.1.
EDIT: Just to clarify my needs a bit more: The APNS seems to be TOO unreliable (at least that is what I have read in other threads regarding APN) as the web service in some cases can have the need for sending 2 distinct message to an iDevice within 1 minute (in some cases seconds), and as far as I have read in other threads this will simply not be possible because of how Apple's server handles ASPNS.
The app i am developing only needs to receive messages from the server when the app is active - is there any way, not using APNs, to do this, e.g. making the app listen for communication on a specific port?
Your scenario seems pretty similar to APPLE PUSH NOTIFICATIONs (APNs).
Ideally your server side should write a code in such a way that if there is any change on server side & need to be informed to all associated devices.
Then your server should post notification Apple server which will then send a notification to all the associated devices.
Refer this link
You already have but can use this code to identify the iOS/Mac deivce
NSString *identifierString = [[NSUserDefaults standardUserDefaults] objectForKey:#"myID"];
if (!identifierString) {
CFUUIDRef identifier = CFUUIDCreate(NULL);
identifierString = (NSString*)CFUUIDCreateString(NULL, identifier);
[[NSUserDefaults standardUserDefaults] setObject:identifierString forKey:#"myID"];
}
NSLog(#"%#",identifierString);
this code works till the lifetime of the app only.
After some search I have decided not to use the APNS, because it seems like people are having all sort of experience with it. I cannot use APNS because my project needs 100 % reliability and instant communication with the server.
I have decided to use tcp communication since my project only will be used in a local network. This will obviously mean more power consumption on the iDevices, but reliability is more crucial to the project.
Hi i am implementing IOS MDM using JavaPNS. Steps performed up to now.
1)I installed xxx.mobileconfig file on IOS Device.
2)I am using JavaPNS for sending notifications.
3)I got PushMagic token from my IOS Device.I got 200 Response.
4)I am using https:// for checkin url. I am using IPCU for generating mobileconfig files.
5)My intension is install some custom payload like disable the camera,disable the youtube ..etc.
6)I am using Restriction payload for that .I am sending the push notification but the IOS Device cannot responding to my server...
The following issue seems to be my issue so can any one guide me.
http://code.google.com/p/javapns/issues/detail?id=103
Any advice would be appreciated.
Try the following
Download and install iPhone Configuration Utility.
Connect your device and open console tab
Send a command from server to the device and see logs (see image below)
If you can see traces of MDM in the logs such as starting, polling etc, that means the device has received the APNS message and is trying to connect to the MDM server for commands.
If in the console you find some error, you need to further investigate.
If you don't see any traces of MDM in the logs, then probably there's some issue - either with the server (invalid push token etc) or with the device's internet connection.
Please post the results and ask for more details if required.