OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
495 stars 263 forks source link

APNS delegate never fired #514

Closed atilsamancioglu closed 1 year ago

atilsamancioglu commented 5 years ago

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:

  1. pod install
  2. pod update
  3. 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.

Nightsd01 commented 5 years ago

@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?

atilsamancioglu commented 5 years ago

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.

jkasten2 commented 5 years ago

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;

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.

atilsamancioglu commented 5 years ago

yes exactly, toggling wifi seemed to do the trick for me too

jkasten2 commented 5 years ago

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.

markosole commented 5 years ago

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:

image

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/

jkasten2 commented 4 years ago

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

JinHoSo commented 4 years ago

@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

kajensen commented 4 years ago

I have reproduced this as well. Toggling wi-fi fixed the issue.

BastianBerlin commented 4 years ago

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!

bharling commented 4 years ago

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

Neilfau commented 4 years ago

Got the same issue, silent notifications do not trigger the delegate method.

bharling commented 4 years ago

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 ?

bharling commented 4 years ago

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 .

Neilfau commented 4 years ago

I’m using native development swift 5.0 & latest version of Xcode.

kajensen commented 4 years ago

I reproduced this on native iOS

rgomezp commented 4 years ago

Ok. This seems to be an Apple issue. My associate @jkasten2 will follow up here with more details

lr-sanchez commented 4 years ago

Same error here with onesignal-cordova-plugin 2.7.0. Then I have added these two options and it worked

Screen Shot 2020-02-25 at 9 29 27
jkasten2 commented 4 years ago

Scope

Follow the below if you are seeing intermittent issues with some devices getting:

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

  1. Go to https://developer.apple.com/bug-reporting/profiles-and-logs/ on your iOS device
  2. 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.
  3. Follow it's instructions on downloading.
  4. 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.

rserro commented 4 years ago

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.

Apromodo commented 4 years ago

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"

apple push servies

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
Ekran Resmi 2020-03-24 17 55 07

IMG_6138

Ekran Resmi 2020-03-24 17 58 20
Lapinou42 commented 4 years ago

Hello guys,

I got this issue too and finally doesn't found a fix for this.

rgomezp commented 4 years ago

@Lapinou42 , Are you seeing this in production builds or just development?

Lapinou42 commented 4 years ago

@rgomezp, Indeed, I see this only in development.

markosole commented 4 years ago

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.

rgomezp commented 4 years ago

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.

careboll72 commented 4 years ago

The solution from @markosole works for me... Only adding PUSH NOTIFICATION capability FROM XCODE...now I am not getting errors...

markosole commented 4 years ago

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.

rgomezp commented 4 years ago

Howdy, I believe it's legacy @markosole

yigitbacakoglu commented 4 years ago

Same issue here;

I'm trying to use OneSignal with latest ionic & capacitor build.

Screenshot 2020-04-20 13 00 31


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, , 0]]


Screenshot 2020-04-20 12 58 28

--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 )

rgomezp commented 4 years ago

@yigitbacakoglu , Thanks for the update. This confirms our suspicions regarding it just being an issue with the sandbox servers. Apple will have to fix this.

daisito commented 4 years ago

The problem is solved by removing the wifi connection and testing with mobile data that turned out for me, despite the fact that I had already generated the certificate for the third time

daisito commented 4 years ago

Captura de Pantalla 2020-05-12 a la(s) 11 06 10 p  m

daisito commented 4 years ago

Solved, it is a communication sandbox conflict with apple

Captura de Pantalla 2020-05-12 a la(s) 11 06 43 p  m

beauchette commented 4 years ago

I've read lots of issues about this APNS Delegate Never Fired problem. I'm currently trying to implement OneSignal (flutter) in my app, it's still in test. Basically, while developing it, I stumbled upon the issue rather quickly. and I discovered that basically, it works almost every time when I'm using wifi, and nearly never (not never) using 4G.

I read that it was an issue communicating with Apple development/sandbox APNs, so I made a TestFlight build, because it's supposed to use the production APNs, and I have the same exact problem. It doesn't work every time, and it works far better using wifi. When a user subscribes properly, I have no problem sending push notification.

I even tried uninstalling / installing my TestFlight build (while deleting the user on OneSignal's dashboard, each time) and sometimes it works, sometimes not. That's so confusing.

I'm using the lib in a really straightforward way, I use the feature requiring the user privacy consent, present the user a popup, and depending on his answer, I invoke consentGranted(true) and everything goes fine, except on certain iOS devices. Also noteworthy: I don't use any third party package that would make things fail.

My problem is that I don't want to put in production something that fails, or forces the user to toggle or activate wifi to work. Is it really a development only problem ? What about my TestFlight build, then ?

sumanc commented 4 years ago

I also started running into this issue recently. One of my iPads consistently runs into this issue on Wi-Fi. There is no bandwidth issue. Lat time it happened, toggling Wi-Fi helped.

It started again two days ago and I decided not to toggle Wi-Fi and leave it like that just in case OneSignal wants to debug or something.

About APNS sandbox vs. production servers, I believe it is not the case. Because yesterday, Apple reported that they ran into this issue in my app when they were reviewing my latest build. I am assuming, when they are testing my app store build they hit production servers.

At this point, I am just waiting on OneSignal engineering team to respond.

rgomezp commented 4 years ago

I wonder if originally, this was indeed a sandbox server issue as people confirmed earlier. But it's possible that something changed which is leading to the same issue even on production environments. Would appreciate a recent stacktrace with OneSignal logging set to verbose.

osmanc777 commented 4 years ago

How about you guys, this error is really a headache since a few days ago everything was working fine for me but suddenly I threw myself that error when trying to subscribe the user.

Today I managed to find a solution or at least make it work.

Steps to follow:

  1. Have the Push Notifications added in Xcode enable these options by the background push: -Background Fetch -Remote notifications

xcodepush

  1. Check if they have any updates to cocoa pods
    pod repo update

    pods1

sudo gem install cocoapods

pods2

then in the root folder of your project run again

pod repo update

pods3

in my case as I am working with ionic, enable onesignal debugging options, building an object of each persimo that requests onesignal

      this.oneSignal.startInit('#####', ####');

      //important debuggin info
      this.oneSignal.setLogLevel({logLevel: 6, visualLevel: 0});

      this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);

      this.oneSignal.handleNotificationReceived().subscribe((respNoti) => {
        // do something when notification is received
      });

      this.oneSignal.handleNotificationOpened().subscribe((respNoti) => {
        // do something when a notification is opened
      });

      this.oneSignal.getIds().then(info => {
        this.userId = info.userId;
        this.userToken = info.pushToken;
        console.log('ID OneSignal: ',this.userId);
        console.log('Token push: ', this.userToken);
      });

      this.oneSignal.endInit();

//function get log status user (debug for safari)

  getStatusUser() {
    this.oneSignal.getPermissionSubscriptionState().then((resp:OSPermissionSubscriptionState) => {
      let Obj:any = {
        Promt:       resp.permissionStatus.hasPrompted,
        PermisosIOS: resp.permissionStatus.status,
        PermisosAnd: resp.permissionStatus.state,
        Suscrito:    resp.subscriptionStatus.subscribed,
        ConfigUser:  resp.subscriptionStatus.userSubscriptionSetting,
        UserID:      resp.subscriptionStatus.userId,
        UserToken:   resp.subscriptionStatus.pushToken
      }

      console.log('OneDebug: ',Obj);
      console.log('iOS: 0 = Not Determined, 1 = Denied, 2 = Authorized ', resp.permissionStatus.status);
      console.log('Android: 1 = Authorized, 2 = Denied ', resp.permissionStatus.state);
      console.log('FCM/APNs: ', resp.subscriptionStatus.pushToken);
    })
  }

pushInfo

then proceed to generate project build again

to know if your push subscription was successful the userId and pushToken must contain a string of strings must not be null

basically the problem is fixed when updating cocoa pods.

Lapinou42 commented 4 years ago

I got this issue on iOS Swift and on Xamarin.iOS. Not all the time, it’s random, very strange.

beauchette commented 4 years ago

As @sumanc @rgomezp state, it may have been a sandbox server issues at one point, this is not the case anymore.

@osmanc777 you don't even need Background Fetch with OneSignal. Also, don't believe you succeeded, it will randomly fail at one point. That's what's tricky about this. sometimes it's toggling wifi, sometimes updating your pods, etc. I tried all of this and more. And I had random failures each time.

I was just implementing push notifications on an app, I had this problem, circled around for days, and then I tried FCM instead of OneSignal, and since then, every device: sandbox or production, 4G, 3G, Wifi, etc always works fine

I prefer OneSignal's interface and functionality, I think it's easier to use (push notifications will be handled by your community manager when in production) we are really disappointed not to be able to use this clearly superior product. And I suppose that by going with FCM, it'll be a pain to change if we ever wanted to.

pikzelz commented 4 years ago

Issue is happening here now too. Updated to the latest version of OneSignal as I like to keep everything up to date and all of a sudden I see this "App Delegate Never Fired" popping up. While it did work before.

I have another client that's using OneSignal in their app that's already published and it runs flawlessly there. Looks like it's an issue with the newest version.

I though it might be related to Firebase as they use some method swizzling too, however after removing Firebase the issue is still there, any other third party framework is not included. It's very confusing as nothing weird shows up in the console.

rgomezp commented 4 years ago

Howdy, One of our community members proposed this workaround which apparently worked for them. Can you please give it a shot and upvote this comment if it also worked for you?

Since this seems to be an Apple problem, the best we can do currently is find a workaround.

sumanc commented 4 years ago

Sure, thanks for the tip. I will try that and keep an eye to make sure the issue went away.

pikzelz commented 4 years ago

That workaround unfortunately doesn’t work for me.

I noticed (in the simulator) that it sometimes reports iOS Simulator Not Supported (obviously) and then after second start (or background -> foreground). It happens to become App Delegate Never Fired, while it should stay Simulator not supported as it can’t even work with the simulator.

daisito commented 4 years ago

That workaround unfortunately doesn’t work for me.

I noticed (in the simulator) that it sometimes reports iOS Simulator Not Supported (obviously) and then after second start (or background -> foreground). It happens to become App Delegate Never Fired, while it should stay Simulator not supported as it can’t even work with the simulator.

Works effectively on real device, test on real device with 3g connection the first time you will subscribe to onesignal

daisito commented 4 years ago

That workaround unfortunately doesn’t work for me. I noticed (in the simulator) that it sometimes reports iOS Simulator Not Supported (obviously) and then after second start (or background -> foreground). It happens to become App Delegate Never Fired, while it should stay Simulator not supported as it can’t even work with the simulator.

Works effectively on real device, test on real device with 3g connection the first time you will subscribe to onesignal

4g or lte connection

pikzelz commented 4 years ago

That workaround unfortunately doesn’t work for me. I noticed (in the simulator) that it sometimes reports iOS Simulator Not Supported (obviously) and then after second start (or background -> foreground). It happens to become App Delegate Never Fired, while it should stay Simulator not supported as it can’t even work with the simulator.

Works effectively on real device, test on real device with 3g connection the first time you will subscribe to onesignal

That doesn’t work either, as described earlier. There’s something weird happening within OneSignal, might be iOS 13.5 related.

daisito commented 4 years ago

That workaround unfortunately doesn’t work for me. I noticed (in the simulator) that it sometimes reports iOS Simulator Not Supported (obviously) and then after second start (or background -> foreground). It happens to become App Delegate Never Fired, while it should stay Simulator not supported as it can’t even work with the simulator.

Works effectively on real device, test on real device with 3g connection the first time you will subscribe to onesignal

That doesn’t work either, as described earlier. There’s something weird happening within OneSignal, might be iOS 13.5 related.

i have used with IOS 13.5, and work for me

ArkaneKhan commented 4 years ago

facing same issue in react native randomly getting Apns delegate never fired. on both wifi and 4g connections as mentioned by others toggling wifi sometime works. i have tested it with test flight build and i can confirm that its happening on test flight build as well. Even tried that background fetch workaround sadly it didn't help. react native: 0.61.4 react-native-onesignal : 3.9.0 ios sdk through pod is OneSignal (2.14.3) IOS 13.5

logs that i am gettting:

2020-07-22 11:07:05.372822+0500 gist[393:13797] VERBOSE: registerForPushNotifications Called:waitingForApnsResponse: 1 2020-07-22 11:07:05.376963+0500 gist[393:13572] VERBOSE: updateNotificationTypes called: 15 2020-07-22 11:07:05.377062+0500 gist[393:13572] VERBOSE: startedRegister: 1 2020-07-22 11:07:05.377096+0500 gist[393:13572] VERBOSE: Prompt For Push Notifications Success 2020-07-22 11:07:05.412364+0500 gist[393:13572] [] nehelper sent invalid result code [1] for Wi-Fi information request 2020-07-22 11:07:05.469 [info][tid:com.facebook.react.JavaScript] 'Device info: ', { pushToken: null, userId: '1444c5d5-0ede-4dc1-81e3-5ce618dd86hj' } 2020-07-22 11:14:48.722163+0500 gist_social[403:15331] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1 2020-07-22 11:14:48.722234+0500 gist[403:15331] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1 2020-07-22 11:14:48.722303+0500 gist[403:15331] DEBUG: OneSignal SessionManager attemptSessionUpgrade with entryAction: 1 2020-07-22 11:14:48.723122+0500 gist[403:15331] DEBUG: OneSignal SessionManager attemptSessionUpgrade try UNATTRIBUTED to INDIRECT upgrade 2020-07-22 11:14:48.723501+0500 gist[403:15331] DEBUG: OSChannelTracker for: notification_id lastChannelObjectReceived: (null) 2020-07-22 11:14:48.723637+0500 gist[403:15331] DEBUG: OSChannelTracker for: iam_id lastChannelObjectReceived: (null) 2020-07-22 11:14:48.724649+0500 gist[403:15331] DEBUG: Trackers after update attempt: ( "OSChannelTracker tag: notification_id influenceType: UNATTRIBUTED indirectIds: (null) directIds: (null)", "OSChannelTracker tag: iam_id influenceType: UNATTRIBUTED indirectIds: (null) directIds: (null)" ) 2020-07-22 11:14:48.724768+0500 gist[403:15331] DEBUG: OneSignal SessionManager sendSessionEndingWithInfluences with influences: ( ) 2020-07-22 11:14:48.725044+0500 gist[403:15331] VERBOSE: Evaluating in app messages 2020-07-22 11:14:50.189527+0500 gist[403:15528] [] tcp_input [C21.1:3] flags=[R] seq=2320494265, ack=0, win=0 state=CLOSED rcv_nxt=2320494265, snd_una=2796291745 2020-07-22 11:14:50.190674+0500 gist[403:15528] [] tcp_input [C21.1:3] flags=[R] seq=2320494265, ack=0, win=0 state=CLOSED rcv_nxt=2320494265, snd_una=2796291745

JArmandoCl commented 4 years ago

I have been facing this issue, but this https://github.com/OneSignal/OneSignal-iOS-SDK/issues/684 solve my problem now my ios user are subscribed to my app in onesignal dashboard, my test device was an iphone 8 ios 13.5