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

Unable to install or launch on device when device is not connected with a cable #21274

Closed
rolfbjarne opened this issue Sep 19, 2024 · 8 comments · Fixed by #21319
Closed

Unable to install or launch on device when device is not connected with a cable #21274

rolfbjarne opened this issue Sep 19, 2024 · 8 comments · Fixed by #21319
Labels
bug If an issue is a bug or a pull request a bug fix iOS Issues affecting iOS
Milestone

Comments

@rolfbjarne
Copy link
Member

Apple platform

iOS

Framework version

net8.0-, net9.0-

Affected platform version

All

Description

mlaunch is unable to install or launch an app on device unless the device is connected with the USB cable, even if "Connects via Network" is enabled in Xcode.

Steps to Reproduce

  1. Make sure device works in Xcode without the cable.
  2. Try to launch an iOS app on the device.

mlaunch will say:

[...]
Please connect the device '[...]'...

Did you find any workaround?

Use the cable.

Relevant logs

No response

@rolfbjarne rolfbjarne added bug If an issue is a bug or a pull request a bug fix iOS Issues affecting iOS labels Sep 19, 2024
@rolfbjarne rolfbjarne added this to the Future milestone Sep 19, 2024
@Too-Many-User-Names
Copy link

If the phone is connected to a device that occupies the Lightning connector, then the workaround isn't viable. We need to debug our app while using this hardware and cannot.

Also, we only started seeing this when the phones were upgraded from iOS 16 to iOS 17. Apple changed the debugging infrastructure in iOS 17. I know that mlaunch was updated to match, but it appears that it doesn't work properly with wireless debugging. This might be related to the new "available" (but not connected) status that is seen when using devicectl.

@rolfbjarne
Copy link
Member Author

If the phone is connected to a device that occupies the Lightning connector, then the workaround isn't viable. We need to debug our app while using this hardware and cannot.

Can you try launching connected, and once the app has launch disconnect from your mac and connect your hardware?

@Too-Many-User-Names
Copy link

Starting the debugging session using the Lightning connector, then disconnecting the cable and connecting the hardware device, results in inconsistent behavior. Sometimes it actually works, but other times, the debugging session seems to disconnect, causing either the debugger or the app to hang.

I appreciate your attempt to find a workaround, but it really would be preferable to have the Microsoft tools manage the wireless debugging connection.

@haavamoa
Copy link

haavamoa commented Sep 25, 2024

Same happens for me, debugging MAUI iOS apps is not possible for me now.

I've seen the same behaviour, where I have to re-connect the device for it to work sometimes. But even if I do, I notice that pages that loads code that has breakpoints in it some times freeze the app. It freeze for a couple of minutes before it continue. When it does continue, hitting the breakpoint works 10% of the times.

The change from my side was to install Xcode 16, but after reading this, I removed Xcode 16 and installed 15.4.

I am on a M1 Mac: macOS 14.6.1.
I am using IntelliJ Rider, but I see the exact same behaviour using VS Code + Meteor.

I am testing two iPhones:
iOS 17.6.1
iOS 18.0

@rolfbjarne
Copy link
Member Author

@haavamoa do you see this behavior with the usb cable connected, or only when disconnecting it after debugging has started? If it's the former, it's a different problem than this issue describes, so please open a new issue.

@haavamoa
Copy link

haavamoa commented Sep 25, 2024

I was not aware that this was the cause of this, because I disconnect / connect a lot during the day due to having multiple devices. So in short, it has been freezing all week and I haven't been able to understand that it is due to me disconnecting / connecting.

But to give you a clear answer, I just rebooted my device with the USB cable connected. When it booted up, I started debugging without any issues. Once I disconnect it, and reconnect it, it starts freezing all over again.

@haavamoa
Copy link

haavamoa commented Sep 26, 2024

I did some research yesterday, I have no idea if this is the reason why this happens but it somehow seem to fix the problems with freezes / not able to debug. I started reading on Xcode 16 release notes, as the only changes I did last week was to upgrade to Xcode 16. It kinda makes sense, but I did remove Xcode16 so it kinda doesn't. But who knows, maybe there's some things getting caches somewhere....

From Xcode 16 Release Notes:

Known Issues
Xcode is sometimes unable to determine if developer mode is enabled when using a device over the network. (131662031) (FB14298506)
Workaround: Connect the device directly to the Mac using a USBC or Lightning cable, then place the device in airplane mode to force Xcode to use the deivce over the wired connection. Once Xcode is successfully using the device over the wired connection, you can turn airplane mode back on, and Xcode will continue to use the wired connection.
If Xcode is unable to determine the state of developer mode on a device, it will report that developer mode is disabled, possibly leading to confusion if developer mode is actually enabled. (133418906)

So I started wondering if this is what I am experiencing. Tried the workaround when the app was in the "freeze" state after I've detached the USB, and both the freeze was gone as well as breakpoints are getting hit after I turn on airplane-mode on the device and turn off WIFI on the Mac...

@haavamoa
Copy link

haavamoa commented Sep 26, 2024

I am starting to believe my issues is not the same as this issue anymore. Created a separate issue for debugging using USB cable only.

rolfbjarne added a commit that referenced this issue Sep 27, 2024
New commits in xamarin/maccore:

* xamarin/maccore@c1a17a2f80 [mlaunch] Install and launch apps without using the AMDevice API for devices that devicectl supports.

Diff: https://github.com/xamarin/maccore/compare/ad4af9cde4..c1a17a2f80

Fixes #21274.
rolfbjarne added a commit that referenced this issue Sep 30, 2024
New commits in xamarin/maccore:

* xamarin/maccore@c1a17a2f80 [mlaunch] Install and launch apps without
using the AMDevice API for devices that devicectl supports.

Diff: https://github.com/xamarin/maccore/compare/ad4af9cde4..c1a17a2f80

Fixes #21274.
azure-pipelines bot pushed a commit that referenced this issue Sep 30, 2024
New commits in xamarin/maccore:

* xamarin/maccore@c1a17a2f80 [mlaunch] Install and launch apps without using the AMDevice API for devices that devicectl supports.

Diff: https://github.com/xamarin/maccore/compare/ad4af9cde4..c1a17a2f80

Fixes #21274.
rolfbjarne added a commit that referenced this issue Oct 2, 2024
New commits in xamarin/maccore:

* xamarin/maccore@c1a17a2f80 [mlaunch] Install and launch apps without
using the AMDevice API for devices that devicectl supports.

Diff: https://github.com/xamarin/maccore/compare/ad4af9cde4..c1a17a2f80

Fixes #21274.
rolfbjarne added a commit that referenced this issue Oct 11, 2024
New commits in xamarin/maccore:

* xamarin/maccore@c1a17a2f80 [mlaunch] Install and launch apps without
using the AMDevice API for devices that devicectl supports.

Diff: https://github.com/xamarin/maccore/compare/ad4af9cde4..c1a17a2f80

Fixes #21274.

Backport of #21319

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix iOS Issues affecting iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants