Detox: Setting notifications permissions to yes on launching does not work anymore (xcode 9, iOS 11)

Created on 3 Oct 2017  路  10Comments  路  Source: wix/Detox

Description

Suddenly setting the notifications permissions to yes on launching does not work anymore.
It worked before, but now I have a system popup asking the user to allow notifications. That popup should not happen.

I think this popup is back again since I upgraded to xcode 9.0. Which also means the simulator is upgraded to iOS 11.0

During the test startup Detox reports:
detox info 7: Trying to set permissions...
detox info 7: Permissions are set
However, it seems they do not.

Steps to Reproduce

before(async () => {
  await detox.init(config, { launchApp: false });
  await device.launchApp({ permissions: { notifications: 'YES' } });
});

Node, Device, Xcode and macOS Versions

  • Node: 8.4.0
  • Device: simulator iPhone 7 iOS 11.0
  • Xcode: 9.0
  • macOS: 10.12.6
  • applesimutils: HEAD-1c62171
  • detox: 5.8.1
questiostack overflow

Most helpful comment

The problem seems running iOS 11 in the simulator. Because I do not have the problem anymore if I switch back to iOS 10.3(.1)

I installed iOS 10.3.1 (yes, .1) in xcode 9 and then selected that version in the package.json like below. For some reason there only 10.3 is accepted.

After this the system notifications popup does not appear anymore.

  "detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/HighFive.app",
        "build": "xcodebuild -project ios/HighFive.xcodeproj -scheme HighFive -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "name": "iPhone 7, iOS 10.3"
      }
    }
  }

All 10 comments

Same here... I'm trying to get this to work since yesterday....

The problem seems running iOS 11 in the simulator. Because I do not have the problem anymore if I switch back to iOS 10.3(.1)

I installed iOS 10.3.1 (yes, .1) in xcode 9 and then selected that version in the package.json like below. For some reason there only 10.3 is accepted.

After this the system notifications popup does not appear anymore.

  "detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/HighFive.app",
        "build": "xcodebuild -project ios/HighFive.xcodeproj -scheme HighFive -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "name": "iPhone 7, iOS 10.3"
      }
    }
  }

This will be fixed soon in AppleSimUtils.

@LeoNatan It's still not working even after installing Detox and AppleSimUtils latest versions 馃槥

@ahmedlhanafy I鈥檒l look into it.

@ahmedlhanafy Unable to reproduce your problem. What does applesimutils --version return?

@LeoNatan My applesimutils version is 0.5.11.
Can this problem arise because I don't ask for push notifications permission when the app starts? In my case, I ask for permissions once the user logs in

0.5.11 supports Xcode 9.
But I don鈥檛 understand鈥攊f you are not asking for permission, how do you know it鈥檚 not working? If you ask for permission and no system alert comes up, that means it is working, otherwise not working.

Sorry for the confusion, what I meant is, I ask for the permission once the user logs in. So when simulating login with Detox, it gets stuck on the first screen (after login) that shows the permission popup. I don't ask for the permission right away when the app starts, I delay asking for it until the user logs in.

cc @LeoNatan

Was this page helpful?
0 / 5 - 0 ratings