OneSignal-iOS-SDK
OneSignal-iOS-SDK copied to clipboard
APNS delegate never fired
Description:
APNS delegate never fired in Xcode 11 beta 5
Environment
Xcode 11 Beta5
This is my pod file:
target 'MyApp' do use_frameworks!
pod 'Firebase/Analytics' pod 'Firebase/Auth' pod 'Firebase/Core' pod 'Firebase/Firestore' pod 'Firebase/Storage' pod 'SDWebImage' pod 'OneSignal', '>= 2.6.2', '< 3.0'
target 'OneSignalNotificationServiceExtension' do pod 'OneSignal', '>= 2.6.2', '< 3.0' end
end
Steps to Reproduce Issue:
- pod install
- pod update
- try to register an iPhone device
Anything else:
I've been trying to make this work in Xcode 11 beta5. first we had this issue now it's resolved. I updated the pod and it seemed OK for a while. I managed to subscribe my phone but after a while, out of blue, it shows me APNS delegate never fired in all users and my phone is unsubscribed anyhow.
@atilsamancioglu can you describe your issue a bit more especially the “APNS delegate”..? Are you talking about the “deprecated app delegate methods” warning? Is the issue basically that your phone is now unsubscribed and you’re not getting push notifications?
hi, yes it gets unsubscribed but I don't get any error in the logs, it just happens out of nowhere. I only see this "APNS delegate never fired" message when I go to all users tab in dashboard.
I did some testing on iPadOS 13 Beta 7 with Xcode 11 Beta 5 and it seems for some reason when calling [[UIApplication sharedApplication] registerForRemoteNotifications]; APNs never responses.
Neither of the AppDelegate methods are called by iOS sometimes to indicate a success OR failure;
application:didFailToRegisterForRemoteNotificationsWithErrorapplication:didRegisterForRemoteNotificationsWithDeviceToken
Even restarting the app or uninstalling it and reinstalling does not help. However what seems to get things working is toggling WiFi. This seems to indicate something changed in iOS on how it is handling connects to Apple's APNs server.
We are continuing to test and will provide more details here.
@atilsamancioglu Let me know if you are seeing the same behavior I noted above.
yes exactly, toggling wifi seemed to do the trick for me too
I have been testing on two different iPadOS devices and have yet to see this issue again. Not even a slow response which I was seeing before sometimes.
I suspect this was some kind of issue on Apple's servers, possibly they have different servers handling responses for the iOS 13 beta.
@atilsamancioglu Let us know if you are able to reproduce the issue again. If so I recommend getting the full system log from Window > "Devices and Simulators" and press the "Open Console" for your device. The log should then be shared with Apple.
Hi guys, I am having similar problem where Wifi reset did not help. When App asks me do I allow to receive notifications, I confirm with Allow and second after I get this on the log:
Getting notification settings (async) Got notification settings [ hasResult: 1 hasCompletionHandler: 1 ] Getting badge number (sync) Got badge number [ badge: (null) ]
On the OneSignal dashboard I can see all details about SDK version, build version, OS version etc. But phone is not getting PUSH TOKEN.
Xcode: 11 iOS device: 13.1.3
Here is what I have in the app.js
if (application.ios) {
let opts = NSMutableDictionary.new();
TnsOneSignal.initWithLaunchOptionsAppIdHandleNotificationReceivedHandleNotificationActionSettings({},
'MY_TOKEN',
(notificationReceived) => {
console.log(notification);
},
(notificationAction) => {
console.log(notification);
},
// (settings) => {
// // console.log(notification);
// }
opts
);
}
I had to add opts because app was crashing and saying that 5th argument is missing. I don't know if this is ok or I need to use something else instead.
Here is what I have installed:

Here is what I've found but I don't really understand any of it https://onesignal.com/blog/ios-13-introduces-4-breaking-changes-to-notifications/
We were able to reproduce this issue once again on iPadOS 13.2 with a development app. Like before, toggling the wifi connection once again fixed the issue.
This time however I have captured the logs from Xcode > Window > "Devices and Simulators" and press the "Open Console".
default 17:24:12.757668-0800 apsd _CFNetworkIsConnectedToInternet returning 1, flagsValid: 1, flags: 0x2
error 17:24:12.757893-0800 apsd Task <8328A9BD-E011-4C05-B23C-FAB986B21615>.<1> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
default 17:24:12.757961-0800 apsd Task <8328A9BD-E011-4C05-B23C-FAB986B21615>.<1> summary for task failure {transaction_duration_ms=23, response_status=0, cache_hit=0}
error 17:24:12.758038-0800 apsd Task <8328A9BD-E011-4C05-B23C-FAB986B21615>.<1> finished with error [-1003] Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x139e1dc00 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, NSErrorFailingURLStringKey=<private>, NSErrorFailingURLKey=<private>, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=A server with the specified hostname could not be found.}
default 17:24:12.758162-0800 apsd <private> Calling configuration completion blocks, expiration date Wed Jan 8 17:39:12 2020 error: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x139e1dc00 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, NSErrorFailingURLStringKey=<private>, NSErrorFailingURLKey=<private>, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=A server with the specified hostname could not be found.}
default 17:24:12.758213-0800 apsd removing all entries config 0x139db3b70
default 17:24:12.758341-0800 apsd APSTCPStream <private> got config <private> -- opened? YES
default 17:24:12.758805-0800 apsd removing all entries config 0x139db3b70
default 17:24:12.759093-0800 apsd Failed to load config bag: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x139e1dc00 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, NSErrorFailingURLStringKey=<private>, NSErrorFailingURLKey=<private>, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=A server with the specified hostname could not be found.}
default 17:24:12.759181-0800 apsd Using DNS TXT record lookup to determine load balance count for development
default 17:24:12.759255-0800 apsd <private> performing DNS lookup for <private>
In this instance it seems that some DNS look up continued to fail for an APNs connection, noted by the apsd process name at the start of each line.
For anyone else seeing the "APNS delegate never fired" error for you device it would be helpful you can capture the log as well. I recommend searching for "apsd Failed to load config bag:" first to see if this matches something like the above. If this isn't present try just searching for " apsd" or filter to the apsd process in the console.
We were only able to find one other instance of a similar apsd error log noted below: https://stackoverflow.com/questions/59298620/apns-connection-failure
@jkasten2 I got the same error
2020-01-22 19:50:49.585000+0900 TestApp[4199:1308229] VERBOSE: Calling OneSignal create/on_session 2020-01-22 19:50:49.586885+0900 TestApp[4199:1308229] VERBOSE: HTTP Request (OSRequestRegisterUser) with URL: https://onesignal.com/api/v1/players, with parameters: { "app_id" : "6d88c25b-8e37-4d35-b6ee-3278a5856379", "net_type" : 1, "test_type" : 1, "as_id" : "EA0025DC-FCBC-409C-9015-9603ADE09FF7", "ios_bundle" : "com.testApp.mobileapp", "device_type" : 0, "sdk_type" : "react", "sdk" : "021204", "language" : "ko-KR", "device_os" : "13.3", "game_version" : "1", "timezone" : 32400, "ad_id" : "8F7C215F-5202-4C92-9D40-87133701AF08", "notification_types" : -14, "device_model" : "iPhone8,4", "carrier" : "LG U+" } 2020-01-22 19:50:50.159113+0900 TestApp[4199:1308207] VERBOSE: network response (OSRequestRegisterUser): { id = "50fa620f-499f-41cc-bb59-a51ef5afd71a"; success = 1; } 2020-01-22 19:50:50.159671+0900 TestApp[4199:1308207] Request <OSRequestRegisterUser: 0x2818e53b0> success result { id = "50fa620f-499f-41cc-bb59-a51ef5afd71a"; success = 1; } 2020-01-22 19:50:50.160299+0900 TestApp[4199:1307975] VERBOSE: on_session result: { push = { id = "50fa620f-499f-41cc-bb59-a51ef5afd71a"; success = 1; }; } 2020-01-22 19:50:50.166886+0900 TestApp[4199:1307975] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1 2020-01-22 19:50:50.167085+0900 TestApp[4199:1307975] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1 2020-01-22 19:51:04.677465+0900 TestApp[4199:1308381] Connection 20: received failure notification 2020-01-22 19:51:04.677550+0900 TestApp[4199:1308381] Connection 20: failed to connect 1:50, reason 0 2020-01-22 19:51:04.677592+0900 TestApp[4199:1308381] Connection 20: encountered error(1:50) 2020-01-22 19:51:04.679286+0900 TestApp[4199:1308381] Task <14920229-AACB-4EC2-9E3A-55F3F39FFC0C>.<1> HTTP load failed, 0/0 bytes (error code: -1009 [1:50]) 2020-01-22 19:51:04.680278+0900 TestApp[4199:1307975] Task <14920229-AACB-4EC2-9E3A-55F3F39FFC0C>.<1> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={NSErrorFailingURLStringKey=https://play.googleapis.com/log/batch, _kCFStreamErrorDomainKey=1, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <14920229-AACB-4EC2-9E3A-55F3F39FFC0C>.<1>, NSURLErrorNetworkUnavailableReasonKey=0, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <14920229-AACB-4EC2-9E3A-55F3F39FFC0C>.<1>" ), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLKey=https://play.googleapis.com/log/batch, NSUnderlyingError=0x2818d89c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={NSURLErrorNetworkUnavailableReasonKey=0, _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _kCFStreamErrorCodeKey=50} 2020-01-22 19:54:17.721933+0900 TestApp[4199:1309020] [] tcp_input [C7.1:3] flags=[R] seq=866249271, ack=0, win=0 state=CLOSED rcv_nxt=866249271, snd_una=2172463612 2020-01-22 19:54:17.722527+0900 TestApp[4199:1309020] [] tcp_input [C7.1:3] flags=[R] seq=866249271, ack=0, win=0 state=CLOSED rcv_nxt=866249271, snd_una=2172463612 2020-01-22 19:54:17.722757+0900 TestApp[4199:1309020] [] tcp_input [C7.1:3] flags=[R] seq=866249271, ack=0, win=0 state=CLOSED rcv_nxt=866249271, snd_una=2172463612
I have reproduced this as well. Toggling wi-fi fixed the issue.
I have reproduced this as well. Toggling wi-fi fixed the issue.
If you mean turning wifi on and off , I tried that and it did not solve the problem. Plus - we can not expect that our users do that :)
(running same build on an iPhone 5 with iOS 10.3.4 - no probs at all; so I rather feel this issue is coming along with the new iOS version)
Is there anyone from OneSignal taking care of this? It seems since 12.2 there are massive problems with OneSignal / Ionic / iOS ... Who has an idea? I'd love to hear!
Also seeing this ourselves over the last couple of days. Same error code for IOS, also seeing similar things for google play APNS.
Our apps are built on phonegap build as well
Got the same issue, silent notifications do not trigger the delegate method.
We're seeing this error consistently now for all new builds via phonegap ( PGB and CLI locally ). We've tried plugin versions 2.4.5, 2.7.0 and 2.8.3 - all give the Apns delegate never fired error.
Is there any update to this issue at all ?
We seem to be getting somewhere using the 2.8.3 plugin version and making sure we use the legacy build system on xcode, it looks like something may have changed there recently. Unfortunately looks like the build flags needed are not supported on phonegap build so we're going to have to ditch that :(, it's a day of sadness as a good bit of our production pipeline depends on that .
I’m using native development swift 5.0 & latest version of Xcode.
I reproduced this on native iOS
Ok. This seems to be an Apple issue. My associate @jkasten2 will follow up here with more details
Same error here with onesignal-cordova-plugin 2.7.0. Then I have added these two options and it worked

Scope
Follow the below if you are seeing intermittent issues with some devices getting:
- "APNS delegate never fired" in the Xcodde log or on the OneSignal dashbaord user list
- If you called
[[UIApplication sharedApplication] registerForRemoteNotifications]butapplication:didFailToRegisterForRemoteNotificationsWithErrornorapplication:didRegisterForRemoteNotificationsWithDeviceTokenis firing even after 60 seconds.- With our without OneSignal
If you are consistently getting "APNS delegate never fired" on multiple devices then this points to a different issue. Most likely a setup issue with OneSignal, provisioning settings, or another library / SDK conflicting with OneSignal. Please open a new ticket if this is the case.
Gathering more details
Before creating a ticket with Apple I would like to get a few more details.
1. Logs with private filled in
Since the logs that were captured here did not have the "Messages Extensions Logging" profile installed on the iOS device we are not able to see some <private> fields such as the following.
default 17:24:12.759255-0800 apsd <private> performing DNS lookup for <private>
These will be key to give the enough detail to Apple to debug the issue.
So before you see the issue please follow these steps to install the profiles
- Go to https://developer.apple.com/bug-reporting/profiles-and-logs/ on your iOS device
- Tap on "Profile" to the right of "APNS (Apple Push Notification Service) for iOS".
- Also recommend downloading "mDNSResponder for iOS", "CFNetwork for iOS" in case APNS doesn't provide all the details needed.
- Follow it's instructions on downloading.
- Lastly make sure go to Settings > General > Profiles and install it as Apple instructions.
When you reproduce the issue go to Xcode > Window > "Devices and Simulators" and press the "Open Console". Filter on apsd. If this is an issue you should see a log like the following.
https://github.com/OneSignal/OneSignal-iOS-SDK/issues/514#issuecomment-572373987
2. Reproduce with a production build
Since Apple uses it's sandbox server for development builds this might be just an issue with these servers. Please attach the logs if you can reproduce with a production build. By production it doesn't have to be a build from the App Store, it can be an ad-hoc build, an .ipa that was built with production, or a test flight build.
3. Reproduce with a custom DNS not resolving Apple's push server
If the device can't connect to Apple's APNS server it should be expected that application:didFailToRegisterForRemoteNotificationsWithError would fire with some kind of network error. If we can reproduce this consistently with a custom DNS then can suggest to Apple to add an error for this so App's have more detail on why the device could not register.
Maybe this can help someone: I was having this problem, tried serveral solutions, nothing. Then I found it was somehow related to having enabled Mac Catalyst on XCode. Turned it off and it worked.
Guys I found a solution if your user looks like in oneSignal
APNS delegate never fired Error
you must add certificate in your iPhone setting>general>profile and add push "apple Push Services"
FİX:it should be like this in the end
For latest version of iPhone
#For detailed installation
1. Use icloud strage folder (desktop backup) for open certificate (aps.cer) open this in iPhone folder app
2.go to settings and install the certificate
3.delete the app and reinstall
4.fin
Hello guys,
I got this issue too and finally doesn't found a fix for this.
@Lapinou42 , Are you seeing this in production builds or just development?
@rgomezp, Indeed, I see this only in development.
Hi guys, I've just updated to latest MacOS, Xcode and iOS on my device. All works fine to me. Open up Xcode project, remove "Background push" what NS adds by itself and just add "Push notification". PS: reconfigure firebase plugin, clean platform etc. I did not try in production yet.
To be honest, I've seen errors in OneSignal Devices list, but after clearing and reconfiguring all, it works as it should.
Howdy @Lapinou42 @markosole , Christophe, this is likely a DNS issue only Apple can fix in that case.
Thanks for your suggestions Marko. Hopefully others can see the same success after trying your workaround.
The solution from @markosole works for me... Only adding PUSH NOTIFICATION capability FROM XCODE...now I am not getting errors...
The solution from @markosole works for me... Only adding PUSH NOTIFICATION capability FROM XCODE...now I am not getting errors...
I am not sure why NativeScript adds Background Notification, what is that for?!. That's probably main reason for APN errors and nobody is checking that. I've tested it several times and work fine.
Howdy, I believe it's legacy @markosole
Same issue here;
I'm trying to use OneSignal with latest ionic & capacitor build.

2020-04-20 12:57:09.459862+0300 App[3452:687251] Request <OSRequestRegisterUser: 0x283aa0b10> success result { id = "579f6df6-c320-492c-9632-f4b7c00c5024"; success = 1; }
To Native Cordova -> OneSignalPush setNotificationReceivedHandler OneSignalPush189461330 ["options": []]
To Native Cordova -> OneSignalPush setNotificationOpenedHandler OneSignalPush189461331 ["options": []]
To Native Cordova -> OneSignalPush setInAppMessageClickHandler OneSignalPush189461332 ["options": []]
To Native Cordova -> OneSignalPush init OneSignalPush189461333 ["options": [e39ffdc8-f1c3-41c1-aac1-462f85f5da3e, 419684480514,

--UPDATE--
I run the app via TestFlight and the error message has gone and notifications worked. But the error still persists when testing through Xcode 11 & Ios 13+ ( real device )