Onesignal-ios-sdk: Egypt blocking OneSignal - Can't subscribe user to Onesignal push notification always returns null Help wanted!!

Created on 10 Oct 2019  ·  26Comments  ·  Source: OneSignal/OneSignal-iOS-SDK

      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    FirebaseApp.configure()
      OneSignal.add(self as OSSubscriptionObserver)


    let notificationReceivedBlock: OSHandleNotificationReceivedBlock = { notification in

         print("Received Notification: \(notification!.payload.notificationID)")
      }

      let notificationOpenedBlock: OSHandleNotificationActionBlock = { result in
         // This block gets called when the user reacts to a notification received
         let payload: OSNotificationPayload = result!.notification.payload

         var fullMessage = payload.body
         print("Message = \(fullMessage)")

         if payload.additionalData != nil {
            if payload.title != nil {
               let messageTitle = payload.title
                  print("Message Title = \(messageTitle!)")
            }

            let additionalData = payload.additionalData
            if additionalData?["actionSelected"] != nil {
               fullMessage = fullMessage! + "\nPressed ButtonID: \(additionalData!["actionSelected"])"
            }
         }
      }

      let onesignalInitSettings = [kOSSettingsKeyAutoPrompt: false,
         kOSSettingsKeyInAppLaunchURL: true]

      OneSignal.initWithLaunchOptions(launchOptions,
         appId: "Removed app id",
         handleNotificationReceived: notificationReceivedBlock,
         handleNotificationAction: notificationOpenedBlock,
         settings: onesignalInitSettings)

      OneSignal.inFocusDisplayType = OSNotificationDisplayType.notification





  OneSignal.promptForPushNotifications(userResponse: { accepted in
    if(accepted){
        OneSignal.setSubscription(true)
    }else{

    }
  })



    return true


}

This is my observer which fires as soon as the app runs even before i allow notifications giving me null push notification

func onOSSubscriptionChanged(_ stateChanges: OSSubscriptionStateChanges!) {
    if !stateChanges.from.subscribed && stateChanges.to.subscribed {
       print("Subscribed for OneSignal push notifications!")
    }
    print("SubscriptionStateChange: \n\(stateChanges)")

    //The player id is inside stateChanges. But be careful, this value can be nil if the user has not granted you permission to send notifications.
    if let playerId = stateChanges.to.userId {
       print("Current playerId \(playerId)")
    }
 }

it also gives this error

SubscriptionStateChange:
Optional( from: ,
to:

Not OneSignal

All 26 comments

SDK version >=2.6.2 & <3.0

Can you tell me what should i do to make it work?

On Mon, Oct 14, 2019 at 11:21 PM Eslam Sabry notifications@github.com
wrote:

Samething using RN wrapper on ios 13.1.2
but working fine on 13.0


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/OneSignal/OneSignal-iOS-SDK/issues/554?email_source=notifications&email_token=ANOMG3V4VUPC6JZPQY6ZCK3QOTPFVA5CNFSM4I7RBPH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBGS43A#issuecomment-541929068,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ANOMG3QCHCGD6LEYUD4I73LQOTPFVANCNFSM4I7RBPHQ
.

Humm, i have same problem when user using proxy or ad blocker ... userId was nil

I’m not using both of those things

On Tue, Oct 15, 2019 at 2:52 AM Ibra notifications@github.com wrote:

Humm, i have same problem when user using proxy or ad blocker ... userId
was nil


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/OneSignal/OneSignal-iOS-SDK/issues/554?email_source=notifications&email_token=ANOMG3RUCYQTTPB4YDYS64DQOUH5FA5CNFSM4I7RBPH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBHBQOI#issuecomment-541988921,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ANOMG3W432P6BGKI4LHX7DDQOUH5FANCNFSM4I7RBPHQ
.

Couple questions:

  1. Are you in Egypt?
  2. This is actually expected behavior (it should subscribe after about 30 seconds, just not immediately)

Yes I am in Egypt I found that onesignal.com is blocked but app.onesignal.com isn't, so is there a way to send the http request to app.onesignal.com instead of onesignal.com?

Unfortunately not

Then how can I solve this problem?

On Mon, Oct 28, 2019 at 11:06 PM Rodrigo Gomez Palacio <
[email protected]> wrote:

Unfortunately not


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/OneSignal/OneSignal-iOS-SDK/issues/554?email_source=notifications&email_token=ANOMG3QT74KFS5KDXTQJYELQQ5H6NA5CNFSM4I7RBPH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECOMSOY#issuecomment-547146043,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ANOMG3X3VHS2QG746SVJIETQQ5H6NANCNFSM4I7RBPHQ
.

You will need to reach out to your ISP and request that they unblock OneSignal

@rgomezp I am in Egypt. It works on Android but not on ios so how is that happening ?
Also I am getting push token but not player Id on ios.

Hi all. If you are still experiencing this, please let us know who your ISP is. We are working on resolving the issue and we believe it has been at least partially fixed.

@gdeglin ISP is WE.

Orange, Vodafone and WE customers should be working

@abdallaemadeldin We received news today that it should be fixed on WE.

Could you confirm if it is fixed or share more details about what you are experiencing? If you still have the problem, please also try clearing your DNS cache (You can google for instructions on how to do this), and try again. Thank you.

i tried opening it from several devices and cleared the dns cache and it's still not working

@gdeglin I tried using WE and Orange and still is not working.

Thank you for the information! We're continuing to work on resolving this based on your feedback. We've heard from several folks that the problem is resolved with most ISPs, but it seems like it is still affecting some users.

It's possible it will start working again on its own (Please let us know if the problem goes away), but we're doing what we can in case there's additional work that needs to be done.

@gdeglin I'm here in Philippines, it's always return null in every ISP here. I tried Smart, Globe, Converge.

any update to solve these issues?

Hello @gdeglin thanks for your efforts team but unfortunately we still have that problem in egypt, as tested with We, Etisalat, Vodafone, all not woking

There is update to that issue please? Egypt's customers are highly affected

@HebaMohamed @AmrAlmagic @DanielRaouf i use app center till they found solution

@abdallaemadeldin I am using vpns in my dev environment to avoid the blocking. Sometimes I use also browserstack to test a compiled version.

@abdallaemadeldin How can I use it?
I use OneSignal Cordova SDK

@abdallaemadeldin
thanks, I will try it and come back to you.

The change to use api.onesignal.com is now included in the release 2.13.0

https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/2.13.0

Was this page helpful?
0 / 5 - 0 ratings