facebook / idb

idb is a flexible command line interface for automating iOS simulators and devices
https://fbidb.io
MIT License
4.55k stars 438 forks source link

idb list-targets, launch, terminate - nothing works #545

Open kpranavk opened 5 years ago

kpranavk commented 5 years ago

Installed brew then these two commands brew tap facebook/fb brew install idb-companion then installed pip 3.7 from https://pip.pypa.io/en/stable/installing/ then installed IDB using pip3.7 install fb-idb

Description

Installations seem to be fine minus the version of pip that it installed 3.7 and I had to run pip3.7 to install fb-idb

Then I tried the following commands with a physical device connected to Mac idb list-targets (issue: lists only physical device as Booted, doesn't list any simulators even though I am running a iPhone 6s simulator

idb launch com.apple.stocks --udid -- I get the error "Please provide a UDID for your target". I did provide the udid :(

idb terminate com.apple.stocks --udid . -- There is no result and no error. It silently completes the command and nothing happens on the iPhone. Stocks app is still open and running in the foreground.

Am I supposed to run any other commands like connect or daemon? The device is physically connected to the same Mac running these commands.

Reproduction

Please contact me on how I can provide the logs to you.

Solution

I don't know, hence asking here :) I am not sure if these commands are only meant to Simulators or Physical device as well.

Additional Information

MacOS Mojave 10.14.3, Xcode 10.3, iPhone 6s Plus w/ iOS 12.4

c-ryan747 commented 5 years ago

idb list-targets

I believe @zeyadsalloum is making some changes here at the moment to improve our detection of the currently available runtimes. It is odd though that your simulators were not picked up, what version of Xcode are you using?

idb launch com.apple.stocks --udid

idb launch attempts to pass through all arguments after the bundle ID to the app on launch. This means that --udid X is actually getting captured by that part of the parser rather than being used to target the right simulator. Moving this before com.apple.stocks should fix this.

Also I think that for physical devices, idb only supports launching developer signed versions of apps.

idb terminate com.apple.stocks --udid

If the app wasn't started through idb then theres no way for us to terminate it due to how locked down physical iPhones are

kpranavk commented 5 years ago

Thanks for the clarification. This is great information so I don't have to poke around this tool anymore :) In my case, it is a physical device and the apps being launched are not developer signed so it looks like I can't terminate them either.

alexpanov commented 5 years ago

Having the same issue as @kpranavk. idb list-targets only shows a physical device even though I am (also) running an iPhone 6s simulator. The physical device is not even connected via a cord. I'm assuming it's getting picked up over wifi. I tried reinstalling, but it didn't help. What else can I do @c-ryan747? Mac OS 10.14.6, XCode 10.3 here.

bassani2014 commented 5 years ago

Hi, is there an update to this issue @c-ryan747 only i'm having issues where running idb list-targets doesn't list simulators? I tried running idb launch com.apple.stocks --udid <my_device_id> but i get the following output:

`2019-11-20 09:05:49,685 [ERROR] - root - Exception thrown in main Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/idb/client/grpc.py", line 200, in get_stub target_udid=self.target_udid File "/usr/local/lib/python3.7/site-packages/idb/common/direct_companion_manager.py", line 101, in get_companion_info raise IdbException("No UDID provided and couldn't find a default companion") idb.common.types.IdbException: No UDID provided and couldn't find a default companion

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/idb/cli/main.py", line 211, in gen_main await root_command.run(args) File "/usr/local/lib/python3.7/site-packages/idb/cli/commands/base.py", line 94, in run return await self._get_subcommand_for_args(args).run(args) File "/usr/local/lib/python3.7/site-packages/idb/cli/commands/base.py", line 126, in run await self._run_impl(args) File "/usr/local/lib/python3.7/site-packages/idb/cli/commands/base.py", line 157, in _run_impl await self.run_with_client(args=args, client=client) File "/usr/local/lib/python3.7/site-packages/idb/cli/commands/launch.py", line 54, in run_with_client stop=signal_handler_event("launch") if args.wait_for else None, File "/usr/local/lib/python3.7/site-packages/idb/common/logging.py", line 110, in _async_wrapper raise self.translate_exception(ex) File "/usr/local/lib/python3.7/site-packages/idb/common/logging.py", line 85, in _async_wrapper value = await function(*args, *kwargs) File "/usr/local/lib/python3.7/site-packages/idb/client/grpc.py", line 151, in func_wrapper return await func(args, **kwargs) File "/usr/local/lib/python3.7/site-packages/idb/client/grpc.py", line 678, in launch async with self.get_stub() as stub, stub.launch.open() as stream: File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 170, in aenter return await self.gen.anext() File "/usr/local/lib/python3.7/site-packages/idb/client/grpc.py", line 205, in get_stub target_udid=none_throws(self.target_udid) File "/usr/local/lib/python3.7/site-packages/idb/utils/typing.py", line 11, in none_throws assert optional is not None, "Unexpected None" AssertionError: Unexpected None`

I'm running Mac OS 10.14.6 / Xcode 11.2.1

calssion commented 4 years ago

same here, 'launch' did work, but nothing happened with 'terminate'

alexpanov commented 4 years ago

I got this resolved by reinstalling the package, both the brew formula and the pip package. I had:

$ pip3 uninstall fb-idb
Uninstalling fb-idb-0.0.7

while the new install was version 1.0.10. The brew package was the latest version.

I now get:

$ idb list-targets
Apple TV | B6F71C8C-E3FF-455B-8F7F-4C47D5178A48 | Shutdown | simulator | tvOS 13.3 | x86_64 | No Companion Connected
...
jiaxw32 commented 4 years ago

same here, 'launch' did work, but nothing happened with 'terminate'

same problem, terminate doesn't work for me, no log.

FareedQ commented 1 year ago

I had the problem with the simulators not showing, but it resolved after I opened and closed my xcode. Worth giving it a shot

Would also be super useful if you added the idb launch --udid com.apple.Maps to the documentation.

Also super grateful for everyone working on this team, you did amazing work :)