Post not yet marked as solved
My use case : i want the app to completely silence a given received alert push notification, based on information the app has locally (completely remove it, and never even display it. Not just change the sound or badge).
So far i found no way of doing that :
notification service extension doesn't let you remove the notification entirely, just change its content.
Using "background / content" notification type then creating the notification locally doesn't work, since "background" notification type is unreliable by design.
voip notifications are banned from being used as a general-purpose background notification mechanism since iOS13
Help would be greatly appreciated.
Post not yet marked as solved
Hi, everyone!
I'm trying to do push notification for apple wallet pass via PHP. My code (in 2 variants) is below. According to guidelines - https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/Updating.html I should get the response in json format, but i don't. Anyway in the server logs I see the response 200. Any notification doesn't appear on the device.
I also tried to push notification via command line tools, but also faced problems - the guideline - https://developer.apple.com/documentation/usernotifications/sending_push_notifications_using_command-line_tools give info only about push notification for your own app, not for the Wallet.
I will be very grateful for any responses.
№1
				$apnsServer = 'tcp://api.push.apple.com:443/3/device/';
		
				$privateKeyPassword = '<password>';
				$message = 'test';
				$deviceToken =
				'<token>';
			
				$pushCertAndKeyPemFile = 'my.pem';
				$stream = stream_context_create();
				stream_context_set_option($stream,
				'ssl',
				'passphrase',
				$privateKeyPassword);
				stream_context_set_option($stream,
				'ssl',
				'local_cert',
				$pushCertAndKeyPemFile);
				$connectionTimeout = 20;
				$connectionType = STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT;
				$connection = stream_socket_client($apnsServer,
				$errorNumber,
				$errorString,
				$connectionTimeout,
				$connectionType,
				$stream);
				if (!$connection){
				echo "Failed to connect to the APNS server. Error no = $errorNumber<br/>";
				exit;
				} else {
				echo "Successfully connected to the APNS. Processing...</br>";
				}
				$messageBody['aps'] = array('alert' => $message,
				'sound' => 'default',
				'badge' => 2,
				);
				$payload = json_encode($messageBody);
				$notification = chr(0) .
				pack('n', 32) .
				pack('H*', $deviceToken) .
				pack('n', strlen($payload)) .
				$payload;
				$wroteSuccessfully = fwrite($connection, $notification, strlen($notification));
				$apple_error_response = fread($connection, 6);
				if (!$wroteSuccessfully){
				echo "Could not send the message<br/>";
				}
				else {
				echo "Successfully sent the message<br/>";
				}
				fclose($connection);
?>
№2
$apnsCert = 'my.pem';
$push_token = '<token>';
$passIdentify = '<pass identify>';
$payload['aps'] = array('alert' => 'Oh hai!', 'badge' => 1, 'sound' => 'default');
$output = json_encode($payload);
$msg = chr(0) . pack('n', 32) . pack('H*', $push_token) . pack('n', strlen($output)) . $output . pack('n', strlen($passIdentify)) . $passIdentify;
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);
$apns = stream_socket_client("api.push.apple.com:443/3/device/", $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
if (!$apns)
exit ("APNS Connection Failed: $error $errorString" . PHP_EOL);
var_dump($apns);
if(fwrite($apns, $msg)) {
		echo "ok";
} else {
		echo "not ok ".error_reporting(E_ALL);
}
socket_close($apns);
fclose($apns);
Post not yet marked as solved
I took delivery of my first M1 Mac (iMac running Big Sur 11.4) and with great anticipation installed my iOS VoIP App from the AppStore.
I was greatly disappointed to see that
There were no VoIP Pushes to start an incoming call
Callkit does not seem to work so I get no Audio.
Am I missing something? Is there some permissions or configuration I might need to set?
Or is it just that Callkit and Pushkit don't work even though it states on developer.apple.com that they are supported on macOS 10.15+
Any advice or guidance greatly appreciated.
Very disappointed :-(
Post not yet marked as solved
I am working on an iOS app that uses push notifications to wake up the app so I can receive SIP calls when app is not in foreground. When all is working, app gets a VOIP push notification while in background which wakes up the app and within 5 seconds I get a SIP invite to process the call. We are using a timer for 5 seconds to wait for SIP after getting VOIP push. The issue I am having is after a certain period of running sip calls test, app stopped receiving SIP invites if it is in background. This happened on our multiple test devices. Restarting the app and rebooting the device didn’t help but uninstalling & installing the same version of app did the trick.
What could be the reasons behind this and how can we fix this?
Have anyone else experienced the similar thing? Any suggestions .
TIA.
Post not yet marked as solved
How to enable the message options on Callkit? Currently, I only see settings for Remind me.
Thank you
Post not yet marked as solved
Apple state the following:
Refresh Your Token Regularly
For security, APNs requires you to refresh your token regularly. Refresh your token no more than once every 20 minutes and no less than once every 60 minutes. APNs rejects any request whose token contains a timestamp that is more than one hour old. Similarly, APNs reports an error if you recreate your tokens more than once every 20 minutes.
On your provider server, set up a recurring task to recreate your token with a current timestamp. Encrypt the token again and attach it to subsequent notification requests.
We use an Azure Function to send push notifications and a scheduled cron-like function to refresh the APNS server tokens.
I originally had a problem because I didn't use a separate HTTP connection for each team ID, this caused some HTTP 403 InvalidProviderToken errors.
I have multiple environments (Dev, UAT, LIVE) and disabled all but LIVE believing that they could be interfering with each other contributing to the #403 error.
Each environment creates their APNS tokens every 51 minutes, each push from that environment uses that token until refreshed.
Will Apple only accept the most recent token used in a push and therefore reject any tokens used on other environments until refreshed on that environment?
For example, assuming each server starts up one minute after each other and sends a push every minute after 5 minutes...
T+0:00 - DEV Booted, Refresh DEV Token (Token A)
T+1:00 - UAT Booted, Refresh UAT Token (Token B)
T+2:00 - LIVE Booted, Refresh LIVE Token (Token C)
...
T+5:01 - Push on DEV (Token A)
T+5:02 - Push on UAT (Token B)
T+5:03 - Push on LIVE (Token C)
LIVE will work because it has the latest APNS token (C), but would DEV and UAT be rejected with a 403 because the token isn't the latest, or would all three work because the lease of the token is supposed to last 60 minutes?
In other words if a push uses a new token does that invalidated all other tokens?
Very much related, presumably I would then hit 429 TooManyProviderTokenUpdates as the three environments could startup at the same time and attempt the refresh in the first minute violating the 'no more than 20 minutes' rule?
I believe the Sandbox and LIVE APNS environments are okay to refresh at the same time.
Kind Regards,
Rob.
Post not yet marked as solved
I am a fresher in the IOS app. I have some questions. Can CallKit support connect the SIP server and handle VoIP? Is another library CallKit needed to solve the above case?
Many thanks.
Post not yet marked as solved
Hey,
I would like to ask when we should call completion handler for didReceiveIncomingPushWithPayload delegate method if we have some async code fired inside.
Let's have following examples:
(completion called already in same runloop cycle)
private let provider: CXProvider
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
/// code to get call info
provider.reportNewIncomingCall(with: uuid, update: update) { error in
/// some code here
}
completion()
}
(completion called at "future" when we "finish" handling voip notification, potentially future runloop cycle)
private let provider: CXProvider
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
/// code to get call info
provider.reportNewIncomingCall(with: uuid, update: update) { error in
/// some code here
completion()
}
}
(error cases in both examples were omitted but i'm aware I should handle them too)
Which one is more correct?
Post not yet marked as solved
I had a problem with VoIP and Standard notifications with iOS 14.X only devices.
My scenario is as follows:
I have two iOS devices:
User A, User B
Interrupt the internet connection at user B
User A call User B via my VoIP application
Wait 15 seconds and activate the internet for B
Issue:
VoIP notification of the call is not received for User B
Side effect:
Randomly after this scenario, User B may no longer receive VoIP and standard (for text) notifications until I reboot the device.
PS: If user B is using iOS 12 or iOS 13 it works fine.
Post not yet marked as solved
I had a problem with VoIP and Standard notifications with iOS 14.X only devices.
My scenario is as follows:
I have two iOS devices:
User A, User B
Interrupt the internet connection at user B
User A call User B via my VoIP application
Wait 15 seconds and activate the internet for B
Issue:
VoIP notification of the call is not received for User B
Side effect:
Randomly after this scenario, User B may no longer receive VoIP and standard (for text) notifications until I reboot the device.
This side effect is more common when I switch to LTE 7/10
When I switch to WIFI, I was able to reproduce it 1/20
PS: If user B is using iOS 12 or iOS 13 it works fine.
Post not yet marked as solved
Brief background about our application:
We are developing an iOS application where we are utilizing the PushKit and VoIP notification for showing the native Calling UI using CallKit to the end user for the video calling.
We have generated the VoIP certificate from Apple developer portal and we are using the same to send VoIP notifications from backend APIs.
Just for information, our application's backend is in .Net MVC.
Details about the issue we are facing:
The problem we are facing here is with the HTTP/2 notification provider API, which is giving Timeout issue (please refer the error log mentioned below).
This timeout error occurs intermittently. Timeout error is not encountered every time. Once or twice in 5 calls, we get timeout error. If we try again after sometime, it again starts working well, but same intermittent issue is encountered frequently.
Here is the exception details of what we are getting:
System.TimeoutException: The operation has timed out.
at HttpTwo.Http2Client.<Send>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at HttpTwo.Http2Client.<Send>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at HttpTwo.Http2Client.<Post>d__15.MoveNext()
Things we have tried:
Keeping the connection open. (i.e. not closing the connection after every request)
We also tried using third party plugin (PushSharp with HTTP/2)
We would appreciate any help/support on this issue.
Post not yet marked as solved
We've been using remote push notifications from a gateway to allow us to provide auth information.
In some cases there's no sound to tell the user that a notification has arrived.
In our code we specify UNAuthorizationOptionSounds, and the notification settings on the devices are set to allow notifications and sounds for the application.
The client code hasn't changed in a couple of years, so I'm wondering whether something might have happened from the sending side. That's not my strongest area though.
Does anyone know whether there could have been a change in the call generating the push notification which cut off the sound, and where I would look for documentation on that?
Post not yet marked as solved
On my watch only app I added capabilities for Push Notifications and Background remote notifications. Then, in the App I created an instance of my provider. I see the initializer being called, but the delegate methods are never called, so I have no device token. What am I missing?
import Foundation
import PushKit
import ClockKit
final class PushNotificationProvider: NSObject {
let registry = PKPushRegistry(queue: .main)
override init() {
super.init()
registry.delegate = self
registry.desiredPushTypes = [.complication]
}
}
extension PushNotificationProvider: PKPushRegistryDelegate {
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
let token = pushCredentials.token.reduce("") { $0 + String(format: "%02x", $1) }
print(token)
}
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async {
// Called on the main queue based on the PKPushRegistry queue parameter.
let server = CLKComplicationServer.sharedInstance()
server.activeComplications?.forEach {
server.reloadTimeline(for: $0)
}
}
}
Post not yet marked as solved
I have two problems in my apple account and I wish to help me.
1 - I am an apple developer, I develop many different programs in various fields, whether sports, health, educational ... etc., but I face a problem in uploading programs for my clients on my account, and this problem is that the store rejects the application because(your app does not meet all of our requirements for apps that offer highly regulated services or handle sensitive user data. Specifically:
The account that submits the app must be enrolled in the Apple Developer Program as an organization, and not as an individual.
The guideline 5.1.1(ix) requirements give App Store users confidence that apps operating in highly regulated fields or that require sensitive user information are qualified to provide these services and will responsibly manage their data.),and I don't know what are the steps necessary to be able to upload my client's applications in various categories?
2-what are the steps necessary to increase my limitation in push notifications keys because I face this problem ( You have already reached the maximum allowed number of Keys for this service )
Post not yet marked as solved
Hi team ,
We are developing a new PWA app for one of our products . The main blocker right now is that that PWA app doesn't support push notifications in IOS applications . I see couple of threads where people have already posted these queries, yet wanted to know
If there is any tentative ETA on the push api support for IOS ?
Is this feature request tracked anywhere by the team , if yes whats the tracking reference and how could we expedite the feature delivery- do you have any process for the same?
If the team has decided to not support this feature , Is it documented anywhere ?
Are there any alternatives /workarounds available to enable push notifications or similar feature in IOS PWA apps.
After updating to iOS 15, our app is no longer receiving voip notifications when in a not running (killed) state. However, voip notifications come through just fine if the app is in the foreground or background.
This behavior is specific to iOS 15, as testing the same exact build on iOS 14 works in all 3 states: foreground, background, & killed. Looking through the device console, I see the following logs coming through when running the app on iOS 15:
Killing VoIP app because it failed to post an incoming call in time
VoIP app failed to post incoming call
and then eventually:
VoIP app no longer eligible to launch
I'm aware about needing to report the call to CallKit immediately - this is what we're doing (i.e. it works fine on iOS 14). And after reviewing the PushKit & CallKit docs, I see no changes that would affect this.
Also, I tested this with the Facebook Messenger app, and the same problem was happening; no voip received when the app is killed on iOS 15, but on iOS 14 it works fine.
Anyone know what's going on here?
Post not yet marked as solved
HI ,
I'm trying to adopt callkit with my voip app using iOS 14.7
as Apple announced since iOS 14.4 support webrtc for mobile browsers. my voip app is an ionic/angular using SIPJS lib for VOIP calls . I can detect microphone / camera , register my sip useragent
when I perform an outgoing call , I send to callkit start call action and transaction is done successfully and I have the provider perform action cxstartcallaction successfully , at this moment i configure the avaudiosession to PlayandRecord category and voicechat mode and session didactivate succesfully too.
my issue is after the other side answer the outgoing call , my voip app still using the iphone mic and speaker too (as SIPJS uses the mic to get media stream of the call) so the result :
1- from VOIP app user can hear from both earpiece and speaker and access mic
2- from callkit user can hear from earpiece only but no access to mic so other side doesn't hear any voice
I tried many solutions to re-activate and configure the audiosession when other user answers outgoing call but nothing works
any help is appreciated
Thanks,
marwa
Post not yet marked as solved
Why is there a delay in sending the device token to didRegisterForRemoteNotificationsWithDeviceToken once after the device is registered for APNS?
Is there any reason other than network connectivity for the delay from APNS to send the device token after device is registered with the Apple APNS?
Is this delay limited to certain OS Versions?
Post not yet marked as solved
Hello, everyone.
I have a problem with the push notification of my app, so I'm asking you a question.
I'm currently using Channel Talk, FCM, and Toast.
The current problem is that the app runs (Click X) when you receive a push notification while the app is shut down.
Toast does not come into didFinishLaunchingWithOptions or Viewcontroller lifecycle.
In the case of FCM, it enters DidFinish Launching With Options.
However, in the case of Channel Talk, we are going around the didFinishLaunchingWithOptions part and the life cycle of the view controller.
The error that occurred was the crush of the parts that were forced to opt-out within the functions in the above situation by riding a lifecycle.
But what I want to deal with is that I don't want the channel talk push to ride the Viewcontroller lifecycle with the app turned off.
How should I deal with this?
Post not yet marked as solved
I have concern about our Push-To-Talk app functionality it's working perfect with the iPhone app but It doesn't work with the iPad. It's getting crash every time. any reason why it's not working?