Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting permission not working #3

Closed
billburgess opened this issue Apr 11, 2017 · 8 comments
Closed

Setting permission not working #3

billburgess opened this issue Apr 11, 2017 · 8 comments

Comments

@billburgess
Copy link

When run locally on a clean simulator (app not installed) the command does not set the permissions for notifications.

  1. Open the iOS Simulator (using iPhone 7)
  2. Open terminal
  3. Run command applesimutils --simulator "iPhone 7" --bundle "my.bundle.id" --setPermissions "notifications=YES"
  4. Simulator restarts.
  5. Run test suite
  6. Apple Notification Permission dialog still appears while tests are running

Am I missing something?

@LeoNatan
Copy link
Contributor

LeoNatan commented Apr 12, 2017

You need to provide the simulator UUID for the --simulator argument. Use xcrun simctl list / fbsimctl list to obtain the UUID of the simulator you are using.

@LeoNatan
Copy link
Contributor

I've opened an enhancement issue for this. I'll see what I can do.

@billburgess
Copy link
Author

I tried once with the simulator UUID. Maybe that is the trick. Subsequent runs still seemed to run against the open iPhone 7 simulator and restarted the Springboard. So something is working on the simulator.

The main for me is how would I be able to use this in my CI script. I won't know the UUID on the remote machine where my tests are running, so I can't hardcode a UUID in. Is it possible to fuzzy logic the match and run on the closest match? Or first match?

@LeoNatan
Copy link
Contributor

For now, you can use fbsimctl "iPhone 7" list | tr -s ' ' | cut -d ' ' -f 1 | head -1 to obtain the UUID of the simulator you want to use in your CI.

@LeoNatan
Copy link
Contributor

It might be possible to somehow filter xcrun simctl list as well, but the output there is more complex / less convenient.

@billburgess
Copy link
Author

I'll give that a try. I appreciate the help.

@billburgess
Copy link
Author

Here is the command I ultimately ended up using in my yml file to set the permission. It does work once I set the permissions on the UDID rather than the name.

applesimutils --simulator $(fbsimctl 'iPhone 7' list | tr -s '' | cut -d ' ' -f 1 | head -1) --bundle "com.myapp.bundle" --setPermissions "notifications=YES"

@LeoNatan
Copy link
Contributor

Thanks for posting this. I will work on a future improvement to allow specifying the simulator by name.

LeoNatan added a commit that referenced this issue Apr 18, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants