Post not yet marked as solved
I wanted to integrate location push extension to my app I followed the documentations and applied for the entitlement.
I followed these steps:
I added com.apple.developer.location.push to my app entitlement as follows
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.location.push</key>
<true/>
</dict>
</plist>
I got the location push token and formatted it to string
locationManager.startMonitoringLocationPushes(completion: { data, error in
if let error = error {
print(error)
return
}
guard let data = data else { return }
let token = data.reduce("", {$0 + String(format: "%02X", $1)})
print(token)
})
I exported the APNS push certificate after enabling additional capabilities from the app store connect and keychain. then converted to pem format
openssl x509 -in aps_development.cer -inform der -out PushCert.pem
openssl pkcs12 -nocerts -out PushChatKey.pem -in PushChatKey.p12
Tried to send push using command line
TOPIC="com.myapp.location-query"
CERTIFICATE_FILE_NAME="./test.p12:1234"
CERTIFICATE_KEY_FILE_NAME="./new2k.pem"
APNS_HOST_NAME="api.sandbox.push.apple.com"
DEVICE_TOKEN="FE979AB7DAC975DD19E2F977EDB9BCD13C870AFD97D8D20955039666AA5DXXXX"
curl -v \
-d '{}' \
--header "apns-topic: $TOPIC" \
--header "apns-push-type: location" \
--http2 \
--cert $CERTIFICATE_FILE_NAME \
--cert-type P12 \
--http2 https://$APNS_HOST_NAME/3/device/$DEVICE_TOKEN
and the response is
* Trying 17.188.138.70:443...
* Connected to api.sandbox.push.apple.com (17.188.138.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
* CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS handshake, CERT verify (15):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=api.development.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US
* start date: Dec 10 00:29:46 2021 GMT
* expire date: Jan 9 00:29:45 2023 GMT
* subjectAltName: host "api.sandbox.push.apple.com" matched cert's "api.sandbox.push.apple.com"
* issuer: CN=Apple Public Server RSA CA 12 - G1; O=Apple Inc.; ST=California; C=US
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x11c80ce00)
> POST /3/device/FE979AB7DAC975DD19E2F977EDB9BCD13C870AFD97D8D20955039666AA5DXXXX HTTP/2
> Host: api.sandbox.push.apple.com
> user-agent: curl/7.77.0
> accept: */*
> apns-topic: com.myapp.location-query
> apns-push-type: location
> content-length: 2
> content-type: application/x-www-form-urlencoded
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 1000)!
* We are completely uploaded and fine
< HTTP/2 400
< apns-id: CA7EC88D-E839-318B-D9DC-DCB533F50808
<
* Connection #0 to host api.sandbox.push.apple.com left intact
{"reason":"TopicDisallowed"}%
But I always get TopicDisallowed response
Did I miss something?
Post not yet marked as solved
So i’ve been testing voip calls of my app. One weird issue i noticed is that after few calls iphone stops receiving voip notifications. actually not just voip notifications but notifications from every other apps.
i have two wifi networks at my home. when i switch from one network to other then suddenly voip notifications starts working and if there were any pending notification from other apps then those arrives too as soon as i change the network. Again i test calls few times and it works. then again same issue. if voip notifications doesn’t works then i just switch the network and notifications works.
wondering if its iphone issue or ios or the router configuration thats delaying or preventing the notification from coming in.
Post not yet marked as solved
i have an app with video call integrated and call kit integrated totally fine. when i cold launch the app launch time is absolutely normal.
Now if my app is terminated and i recieve voip notification and see call kit banner and i accept the call from there, it launches my app. But it freezes like for 5 to 10 secs on a white screen. it happens everytime when i receive call and pick it up while app is in terminated state. i also loose the audio in these scenario.
Need help to figure out if app launching from call kit answer call action and from normal tap on icon is any different?
Post not yet marked as solved
Hallo there,
We are using PUSHKIT and CALLKIT for waking up and showing the calls.
But I ask for something like a voip background mode here, because a lot of features of our telephone system requiring an instant answer on SIP level. Sometimes with delay for example, so its not possible to use PUSHKIT here.
So my question is: "How can we run a VOIP App in background, so that we can receive and show an incoming call WITHOUT push notifications?"
Post not yet marked as solved
I am writing a Flutter application that uses VoIP notification. I have successfully integrated PushKit natively in iOS and it is invoking CallKit as well.
When the app is minimized and there is an incoming call, there is a call notification with a decline and answer button. It is a native VoIP CallKit Notification.
What I am trying to achieve is, when a user presses either the answer or decline button, I want to detect those button taps for performing some call declining functionality on the Flutter end.
Attaching some code here what I have done so far
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
let handle : String = payload.dictionaryPayload["handle"] as! String
// let uuidString : String = payload.dictionaryPayload["callUUID"] as! String
self.handleCallAndMethods(handle, completion: completion)
}
func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) {
print(callObserver)
print("Call UUID = ")
print(call.uuid)
if call.isOutgoing == false && call.hasConnected == false && call.hasEnded == false {
print("Call has ended")
}
}
func handleCallAndMethods(_ handle : String, completion: @escaping () -> Void){
let config = CXProviderConfiguration(localizedName: "VoIP Service")
config.supportsVideo = true
config.supportedHandleTypes = [.phoneNumber]
config.maximumCallsPerCallGroup = 1
let callProvider : CXProvider = CXProvider(configuration: config)
// callProvider?.setDelegate(callManager, queue: nil)
let uuid : UUID = UUID()
print("Reaching inside call condition")
let callUpdate = CXCallUpdate()
let phoneNumber = CXHandle(type: .phoneNumber, value: handle)
print(phoneNumber)
callUpdate.remoteHandle = phoneNumber
print(callUpdate)
let bgTaskID = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
callProvider.reportNewIncomingCall(with: uuid,
update: callUpdate, completion: { (error) in
self.callObserver.setDelegate(self, queue: nil)
completion()
})
UIApplication.shared.endBackgroundTask(bgTaskID)
}
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
action.fulfill()
print("Answer button is pressed")
}
func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
action.fulfill()
print("Calling is ended")
}
Post not yet marked as solved
As the title, I just want to receive a VoIP message, then do something.
But it seems to be necessary to do reportNewIncomingCall in didReceiveIncomingPushWith, and it will make the call shows up.
Can I cancel the call before it shows up ?
Post not yet marked as solved
In my VoIP app that uses CallKit, while I'm in a connected call and report to the CXProvider a new incoming one only the CallKit UI is displayed (the screen with End&Accept, Decline and Hold&Accept). There's no sound indication whatsoever of the newly reported call.
Shouldn't there be a knock sound on top of the current call's audio?
Am I missing some required configuration for that?
Thanks in advance.
Post not yet marked as solved
All our applications listed below, once installed in padOS15 (iPad mini 6 15.4.1) are not receiving any remote push notifications.
We built our apps in XCode13.2.1. I also tried to install the latest XCode13.3.1 in macOS Monterey, but I got the same problem.
It has no problem when installed on different devices and versions.
Our apps:
CLOMO SecuredBrowser for iFilter
CLOMO SecuredMailer
CLOMO SecuredDocs
CLOMO SecuredContacts
This is how to replicate it:
Start the app
Press the home button and the app goes to the background
I change the profile settings on our server-side
Wait for the remote push notifications. (the remote push notifications are received on other devices but not on this device)
Expected result: remote push notifications should be shown on the device.
When I checked the console log, I found that com.apple.Preferences removed delivered notifications as shown below.
SpringBoard [com.apple.Preferences] Removing delivered notifications
Post not yet marked as solved
Apple recently introduced and presented Web Push, a new Web Kit tool permitting to send notifications to users on your websites and web apps. However, push notifications have been a thing on macOS since Mavericks. Therefore, what is the difference between these two things ?(https://developer.apple.com/notifications/safari-push-notifications/ ) and that new thing (https://developer.apple.com/videos/play/wwdc2022/10098/)
Post not yet marked as solved
Hello Everyone,
I hope someone can help. We are using PushKit and CallKit as part of a VoIP calling application. This code has been working for several months.
We noticed that as of some time PM Friday 10th, we no longer receive a token when debugging code to a locally connected iPhone in Xcode. Tokens are being generated in live environments and existing users are not affected. If we archive our debug builds to TestFlight the code runs correctly. To clarify:
In debug if we request the cached token using .pushToken(for: voIP) nil is returned.
In debug if we regster, the didUpdate delegate method is never called.
If we publish this same code to TestFlight, didUpdate is called on app start and a call to retrieve the cached token is successful.
The delegate and the pushregistry variable are not becoming nil as far as we can see and considering the code is working in TestFlight, how to you diagnose what is wrong? Code has been tested across a wide range of iPhone devices and releases from 13 through 15.5. The behaviour is consistent in that it never works in debug and always works in TestFlight.
Thanks, Alex
Post not yet marked as solved
I am working on an iOS app where VOIP push notifications are working as expected in the app foreground and background scenario. When the app is terminated by the user and lets say after 1 min the iPhone receives the VOIP push for my app, but the app is not launched in the background and therefore didReceiveIncomingPushWithPayload is never getting called.
Can anyone please help me why am i seeing this behavior ?
Thanks in Advance.
Post not yet marked as solved
Hi,
I've recently faced with an issue while dealing with PushKit and CallKit. Everything was working fine before adding a socket connection method to my code. I want to be connected to the socket before calling reportNewIncomingCall so I adjusted my code accordingly. Then I realized that completion block of reportNewIncomingCall is not being called. I don't understand why, any thoughts?
The part of didReceiveIncomingPushWith delegate method, mentioned above:
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
.
.
.
Log.addedCallInfotoAppDelegate.add("callID: \(String(describing: callID!)) callerName: \(callerName) uuID: \(String(describing: self.uuID!))")
let semaphore = DispatchSemaphore(value: 0)
self.connectSocket { success in
if success {
Log.socketSuccessfullyConnected.add()
} else {
Log.errorWhileConnectingSocket.add()
}
self.update.remoteHandle = CXHandle(type: .phoneNumber, value: callerName)
self.update.hasVideo = false
self.update.localizedCallerName = callerName
self.update.supportsGrouping = false
self.update.supportsUngrouping = false
self.update.supportsHolding = false
self.provider.reportNewIncomingCall(with: self.uuID!, update: self.update) { error in
Log.doneReporting.add()
if error == nil {
Log.didReportIncomingCall.add()
if !stateCheck {
self.provider.reportCall(with: self.uuID!, endedAt: Date(), reason: .answeredElsewhere)
Log.reportedEndedCall.add()
self.uuID = nil
self.callID = nil
Log.deletedCallInfoFromAppDelegate.add()
}
semaphore.signal()
} else {
Log.errorWhileReportingIncomingCall.add(String(describing: error))
semaphore.signal()
}
}
} else {
semaphore.signal()
}
semaphore.wait()
completion()
}
Post not yet marked as solved
I am using push kit and call kit to send VOIP notificatin from my server to my app. The notification's working fine, however it remains there for infinite time unless the user rejects or accepts the call. Is there any way to handle this? Like it automatically expires after 20 seconds.
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
I just placed a test where I've tested my site on different platforms. It's doing well on Andriod devices but not showing responsiveness on ios devices.
What are the possible reasons for this???
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
I'm developing Push Notification for our chat app.
To enable Push Notification, our app will register the device token as well as some other information to another independent service, let's say "RegistrationService". Then any message going through the "RegistrationService" will know which device it should be sent to.
Now my issue is - Since every registration record in "RegistrationService" has a TTL of 24 hour, our app will need to do another registration once the expiration time is reached.
Currently I use the below codes in AppDelegate to start push notification and do the first time registration. I'm thinking if it is possible to resolve the above mentioned issue by embedding a "Timer". If so, can the timer work well when app is running in background?
As we know, Push Notification offers a solution for client to receive the message when app in background. If the timer/registration auto-renew doesn't work in background, it can be a big issue. (From this post, https://developer.apple.com/forums/thread/127444, looks like the timer can't work when app is in background. If so, do you have any other recommended ways to achieve this?)
func application(
_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }
let token = tokenParts.joined()
print("Device Token: \(token)")
UserDefaults.standard.set(token, forKey: "APNSToken")
// Start push notifications
guard let apnsToken = UserDefaults.standard.string(forKey: "APNSToken") else {
print("Failed to get APNS token")
return
}
let semaphore = DispatchSemaphore(value: 0)
DispatchQueue.global(qos: .background).async { [weak self] in
guard let self = self else { return }
guard let chatClient = self.chatClient else { return }
chatClient.startPushNotifications(deviceToken: apnsToken) { result in
switch result {
case .success:
print("Started Push Notifications")
case let .failure(error):
print("Failed To Start Push Notifications: \(error)")
}
semaphore.signal()
}
semaphore.wait()
}
}
Post not yet marked as solved
Hello,
I'm developing Push Notification on IOS 13 for our chat app.
I want to achieve the below scenario -
When the chat app is running in background and the device receives a chat message, (1) the user can see an alert banner popping up; (2) the app can receive the push notification payload inside this block - "application(_:didReceiveRemoteNotification:fetchCompletionHandler:)", which is in App Delegate.
From this wiki (https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623013-application), I assume these can be achieved.
Now I succeeded in (1) but failed in (2).
This "didReceiveRemoteNotification" can never be invoked when the app is in background...
FYI -
when the app is running in foreground, the "didReceiveRemoteNotification" can be called.
Not sure if my testing method is correct...I connect my physical iPhone with the MacBook, open the program in Xcode and hit "run" button in Xcode to run this program.
3.Below please my notification template -
"{"aps":{"mutable-content":1,"sound":"default", "alert":{"title":"New Message"}},"data": "customized content"}
I'm not sure if I will need to add "content-available: 1" as well.
Thanks for your answer!
Post not yet marked as solved
Hi All
I recently found that wrong deactivate audio session event was received on app when user end Celluar call.
Here is my step:
App report to CallKit an incoming call and answer it.
Device receive Celluar call, and user choose Hold/Accept.
and app is notified by held action on Call Provider delegate.
User end Celluar call.
Expected :
app is supposed to receive activate Audio session or unheld event
Real result:
app receive did deactivate event. which cause app to shut audio session.
Can anyone correct on this scenario?
Thanks,
Post not yet marked as solved
Hi All,
I am using silent push data notifications in my iOS App which is used to process some information (not making any API call when silent push is received, just parsing some json dictionary to update state on UI) in background & display data to user. I was conducting some performance test to observe the reliability of silent push notifications for my App & observed the following:
I was testing silent push notifications on 5 iPhone devices
Only 4 out of 5 iPhones received this silent push
In order to see if the iOS itself is blocking these notifications I have reset the settings of iPhone from settings app & this 5th iPhone started receiving silent push notifications without any issues
I know silent push notifications are not guaranteed since they have a low priority than visible push notifications & depends on network conditions of my iPhone. I have ensured all the iPhones I was testing were on WiFi with strong internet connection, not on a low power mode, to ensure the push reliability.
Please suggest me what exactly I am doing wrong in my setup, as some of the iPhones I am testing suddenly stops receiving silent push notifications for my mobile App & they are back to normal after I reset the settings of iPhone from
settings App.
I have tried various things like:
Setting the apns-push-type header
Setting apns-topic
Setting apns-priority
None of them seem to work. Only resetting the settings from settings App is bringing my mobile app to normal state to receive silent push notifications. Not sure at this point what is making my Mobile App to suddenly stop receiving silent push notifications.
Below is the setup I have for my push notification delivery
(My company Notification server) -> (Firebase Cloud Messaging Server) -> APNS -> (My Mobile App)
All My iPhones are on iOS 15.2 & above
I really appreciate any help from any of you, as this is a critical issue that is blocking my production app & I ran out of options trying to fix this issue.