Error when running in a VM
Description I'm trying to install permissions on my sim when running inside a VM for our CI builds. The version we have is throwing an error when trying to set permissions.
This is from our iOS 11 device.
jenkins@Jenkinss-Mac ~ % applesimutils --byId "6B1ACB67-56F7-4610-92AA-74E931411579" --bundle "simpleinout" --setPermissions "notifications=YES, location=always, contacts=YES"
Got error:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
The operation couldn’t be completed. No such file or directory
No such file or directory
If I run the same command against a newer runtime, it crashes out like this:
jenkins@Jenkinss-Mac ~ % xcrun simctl create "iOS14TestDevice" "iPhone 12" iOS14.4
4C6BD085-9785-41C6-B2D8-CE7381389250
jenkins@Jenkinss-Mac ~ % applesimutils --byId "4C6BD085-9785-41C6-B2D8-CE7381389250" --bundle "simpleinout" --setPermissions "notifications=YES, location=always, contacts=YES"
Got error:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
The operation couldn’t be completed. No such file or directory
No such file or directory
2021-04-21 13:17:21.576 applesimutils[17543:145973] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff204d86af __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff202103c9 objc_exception_throw + 48
2 Foundation 0x00007fff211c3879 -[NSURL(NSURL) initFileURLWithPath:] + 665
3 Foundation 0x00007fff211c3536 +[NSURL(NSURL) fileURLWithPath:] + 83
4 applesimutils 0x0000000106ac2ef6 +[SimUtils developerURL] + 262
5 applesimutils 0x0000000106ac3463 +[SimUtils launchDaemonPlistURLForDaemon:] + 155
6 applesimutils 0x0000000106ab73f3 __37+[SetLocationPermission locationdURL]_block_invoke + 31
7 libdispatch.dylib 0x00007fff201bb7c7 _dispatch_client_callout + 8
8 libdispatch.dylib 0x00007fff201bc96b _dispatch_once_callout + 20
9 applesimutils 0x0000000106ab73d2 +[SetLocationPermission locationdURL] + 46
10 applesimutils 0x0000000106ab7ab0 startStopLocationdCtl + 74
11 applesimutils 0x0000000106ab79af +[SetLocationPermission setLocationPermission:forBundleIdentifier:simulatorIdentifier:error:] + 1439
12 applesimutils 0x0000000106ac2617 __performPermissionsPass_block_invoke + 1627
13 CoreFoundation 0x00007fff20452b87 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 7
14 CoreFoundation 0x00007fff20452a04 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 224
15 applesimutils 0x0000000106ac1022 __main_block_invoke.312 + 1756
16 CoreFoundation 0x00007fff20452b87 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 7
17 CoreFoundation 0x00007fff20466f9f -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] + 80
18 applesimutils 0x0000000106abfb03 main + 5927
19 libdyld.dylib 0x00007fff20381621 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
zsh: abort applesimutils --byId "4C6BD085-9785-41C6-B2D8-CE7381389250" --bundle
Using version 0.9.2
Steps to Reproduce
Steps to reproduce the behavior:
applesimutils --byId "6B1ACB67-56F7-4610-92AA-74E931411579" --bundle "simpleinout" --setPermissions "notifications=YES, location=always, contacts=YES"
Error listed above
Expected Behavior Permissions should set and sim should be ready to run tests.
Screenshots If applicable, add screenshots to help explain your problem.
Environment
- macOS version: 11.1
- Xcode version: 12.4
- Runtimes: iOS 11.4, 12.4
Additional Context I'm not entirely sure how this issue cropped up. We've had this working on our local machines. I can't recreate it on my local, but our VM seems to be stricken at the moment. I'm not sure how to fix this at the moment, any help would be greatly appreciated.
These are the errors I get when I create the device manually and try to set the permissions on it. When it runs in the context of our CI, we get this message:
+ tmp/tools/macos/run.sh 'bin/test -i'
Capture IP address of the virtual machine
Running 'bin/test -i' in iOS 14 v3 @ ***IPADDRESS***
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405):
Unable to boot device in current state: Booted
bin/test: line 93: applesimutils: command not found
bin/test is a bash script that starts the sim, applies the permissions to it, and executes our tests.
I am also facing same issue any issues on this?