How to work out the Aps payload from CloudKit subscription - cloudkit

As far as my understanding goes, APS is the payload that is sent by APNS to the devices.
I'm using iCloud/Cloudkit as the backend for my app. I have a few Record Zone Subscriptions and Query Subscriptions.
The question is: how do I inspect/debug the actual APS payload on my dev machine? First problem being simulator ignores the notification.
Assuming I have to setup an http proxy, how would I set one up for a real device?
Would it be easiest to just to approximate the Aps payload from the config of my CKSubscriptions?

I use Charlesproxy for debugging requests and response from my device.Just install http://www.charlesproxy.com and enable the proxy. Then on your iPhone, go to your WiFi settings and set the http-proxy to manual and configure it to the ip of your Mac. You can then see all requests and response from your device. You can filter that and even add debug breakpoints. See the Charlesproxy documentation for this.
But besides that, you will just receive the notifications in you application didReceiveRemoteNotification. the notification will be of type CKQueryNotification. Your data will be a

Related

Server certificate change issue for Huawei PushKit Uplink message

Currently, if you want to apply "Uplink message sending" for your apps in Huawei PushKit, you must provide a Url and it's Https certificate
If the certificate gets expired or changed, an update is needed for the uplink to keep working.
However, the issue gets serious when the number of apps becomes relatively large. This would make the update process difficult.
Is there anyway to apply the uplink message without worrying about the certificate change over time?
Is there a reason that Huawei does not try to get the certificate of the passed Url itself and check it periodically and update it?
Thanks in advance
Is there anyway to apply the uplink message without worrying about the
certificate change over time?
How many apps do you have and and how frequently do you change your server certificate? According to the instruction here, it is just a matter of changing the URL and upload the PEM file. Per Shirley's suggestion, the developer server monitors the certificate validity period and will remind you to update the certificate before it expires.
Sign in to AppGallery Connect.
Select My projects, find your project from the project list, and
click the app for which you need to send messages. Go to Grow > Push
Kit > Settings. Find Receive uplink message and click Enable.
Set Destination URL and HTTPS certificate (in PEM format).
Is there a reason that Huawei does not try to get the certificate of
the passed Url itself and check it periodically and update it?
Huawei AppGallery Connect treats security and communication seriously so it is important to make sure that the developer follow the security best practice to update their own HTTPS URL & certificate.
Is there anyway to apply the uplink message without worrying about the certificate change over time?
If the uplink message fails to be sent, the device will receive an error code. After receiving the error code, the device instructs the device to update the certificate.Alternatively, the developer server monitors the certificate validity period and reminds you to update the certificate before it expires.
Is there a reason that Huawei does not try to get the certificate of the passed Url itself and check it periodically and update it?
To meet security compliance requirements, Huawei must check the validity of certificates.

Inconsistent notifications watching files with Google Drive REST API V3

I'm using this endpoint to subscribe for changes on a file: https://developers.google.com/drive/v3/reference/files/watch. While I'm receiving callbacks, some notifications don't happen right away and others seem to be dropped completely. I'm trying to figure out whether this is an issue with the service or something I'm not understanding about the API.
I've tried testing our setup with several different types of files and have gotten similar results with inconsistent notifications.
Wonder if anyone has done tests or has insider information about the reliability of change notifications? Is it around 99% or more like 50%? What is the expected distribution of delays? (it's definitely not instantaneous)
Without knowing what you have already done, I can only suggest that you check Push Notifications and see if you've missed some of the important things.
It was discussed that, to use push notifications, you need to do three things:
Register the domain of your receiving URL.
Set up your receiving URL, or "Webhook" callback receiver.
Set up a notification channel for each resource endpoint you want to watch.
In addition to that, note that there are required properties when making watch requests:
An id property string that uniquely identifies this new notification channel within your project. We recommend that you use a universally unique identifier (UUID) or any similar unique string.
A type property string set to the value web_hook.
An address property string set to the URL that listens and responds to notifications for this notification channel. This is your Webhook callback URL, and it must use HTTPS.
Also, Drive API will be able to send notifications to this HTTPS address only if there is a valid SSL certificate installed on your web server. Invalid certificates include:
Self-signed certificates.
Certificates signed by an untrusted source.
Certificates that have been revoked.
Certificates that have a subject that doesn't match the target hostname.
Hope that helps.

Verify that network request was sent by iOS application

I'm trying to verify that HTTP requests from iOS application were really sent from mobile application. Currently server code just checking 'User-Agent' HTTP header and of course it's not very reliable solution.
Here is how I see current iOS SDK can be used to verify that client is an actual iPhone user.
Push notifications
iOS app requests push token from the operating system and sends it to server
Server sends push notification to application with hidden identifier
iOS app sends received identifier to server
Server responds with cookie
Here on the first stages of communication we can verify that user is mobile user because how else she got identifier from push notification to specific app.
dis. Not quite reliable even if we can repeat push notification. Misuse of push notifications.
In-App purchase
It is possible to reuse receipt verification here.
dis. Obvious misuse. Confusing.
So the question is – are there any proper ways to confirm that request was sent from iOS application, from iOS device ?
iOS11 introduces new API https://developer.apple.com/documentation/devicecheck#overview
It looks like it solves the problem.

Understanding details of Apple Push Notification Service

Is it true that we can use any component for our own server component? I mean it can be a Java or C# TCP/IP client which connects with Apple servers to push notifications. This can also be a console application, is that right?
Also, is it right that we have to push notifications for APN server, with each and every deviceTokens registered on our own server?
You can use whatever language you want and you will have to send push notifications for every registered device token. You should also investigate apple's feedback API's which you should periodically check to see which of your devices are no longer registered because sending a push has no feedback and you will not know if it is being received or not. If you use a service such as Urban Airship the setup will be much much easier to start and they have helpful API's to give them a group of device tokens or to do a mass push to all registered device tokens.
You are right on both accounts. You can write your own method to send it, and you must send it to each device id.
framework that might help you:
http://www.easyapns.com/

I want to use Push Notification for My app for IPhone

I want to use Push Notification service for my app ,but I am not sure how to utilize this ,please help
you have a good tutorial for push notifications here explaining the server side implementation details:
http://blog.boxedice.com/2009/07/10/how-to-build-an-apple-push-notification-provider-server-tutorial/
and here explaining the client side details:
http://mobiforge.com/developing/story/programming-apple-push-notification-services
Also here is the link to the Apple developer guide on local and remote push notifications: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html
Hope this helps.
To send remote push notifications using PHP, I suggest you take a look at the php-apns project on Google Code. I've had good experience with it.
You will have to enable push notifications on iTunes Connect, if you didn't do that already. Your app will have to get the push notifications token from the OS, and deliver it to server. This token may change from one launch to another, so recommended way is to fetch the notification token at launch, and deliver it to the server. Server can then decide when it wants to deliver a notification to which device; at that point, you use php-apns which will connect to Apple's server on port 2195 (make sure you have a hosting which allows that) and, using several certificates you also put on the server, communicate with it.
Make sure the certificates are not downloadable when you upload them on the server.
You cannot test push notifications on the Simulator.