Bug 461046

Summary: Totally can't use in iOS 16.0.3
Product: [Applications] kdeconnect Reporter: Bruce <xiediebruce>
Component: ios-applicationAssignee: Apollo Zhu <public-apollonian>
Status: CONFIRMED ---    
Severity: normal CC: i, nicolas.fella, public-apollonian
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Apple App Store   
OS: iOS   
URL: https://invent.kde.org/network/kdeconnect-ios/-/merge_requests/84
Latest Commit: Version Fixed/Implemented In: 0.3.1
Sentry Crash Report:
Attachments: KDE Connect Devices
logs from iPhone 11 iOS 16.0.3(20A392)
logs from iPad(9th generation) SoftwareVerion 15.4
isDebuggingDiscovery.log.jpg

Description Bruce 2022-10-27 02:47:18 UTC
Created attachment 153229 [details]
KDE Connect Devices

SOFTWARE/OS VERSIONS:

- 1. macOS: Big Sur 11.5.1 (20G80) , using "Soduto 1.0.1(11)" KDE client, download from here: https://www.soduto.com/
- 2. iPhone: iOS 16.0.3, using "KDE Connect 0.3.0(6)" KDE client, installed from Testflight: https://testflight.apple.com/join/vxCluwBF
- 3. iPad: iPadOS 15.4, using "KDE Connect 0.3.0(6)" KDE client, installed from Testflight: https://testflight.apple.com/join/vxCluwBF
- 4. Android Phone:MIUI 13.0.8 (Android 12), using "KDE Connect 1.19.1" KDE client, installed from Google Play Store 

Summary: 
At first, macOS, iPad, iPhone(iOS 15.x) and Android phone are all can discover each other, but since I update iPhone iOS to 16.0.3, iPhone can't discover any other device and can't be discovered by other device,  I've tried refresh discovery, tried Configure other Devices By IP, neither these two methods works, so I believe it's because the APP in iPhone not compatible with the latest iOS version 16.0.3.

BTW, the other three(macOS, iPad, Android Phone) works fine, they can discover each other, and can send files or share clipboard to each other.
Comment 1 Apollo Zhu 2022-10-28 21:50:48 UTC
This is interesting. I'm currently using iOS 16.2 (beta) with 0.3.0 (6) on iPhone and Soduto 1.0.1 (11) on macOS Ventura 13.1. They can discover each other and pair with no problem.

It will be great if you can share a little more information so we can potentially uncover what's going on. Here's how:

Check the guide at https://invent.kde.org/network/kdeconnect-ios/-/wikis/Debug/Options and follow the instructions to enable:

1. isDebugging
2. isDebuggingDiscovery

Then, do a refresh. You should now find debug logs at Settings tab, Advanced Settings > Logs. I assume there should be entries under "Errors and Faults" that you can share with us to help us identify the problem, but if not then maybe you can share things under "All Messages". I'd recommend also do this on both the iPad and the iPhone to see which side is causing the problem.

Unfortunately we don't have an export log functionality (nor can we directly access these logs), so you have to take screenshots and share that with us 😅 Feel free to redact information that you don't want to share.

Thank you very much
Comment 2 Apollo Zhu 2022-10-29 06:22:32 UTC
Okay, I discovered a similar problem between iOS 16 device and Android device where refreshing on Android will let the Android device appear on iOS, but refreshing on iOS will cause both to disappear on either side. Not sure if this is the same problem and I'll continue experimenting.

If you can, could you try the App Store version on iOS 16 (instead of the one from TestFlight) and see if it makes any difference?
Comment 3 Bruce 2022-10-29 06:59:36 UTC
Created attachment 153289 [details]
logs from iPhone 11 iOS 16.0.3(20A392)
Comment 4 Bruce 2022-10-29 07:00:11 UTC
Created attachment 153290 [details]
logs from iPad(9th generation) SoftwareVerion 15.4
Comment 5 Bruce 2022-10-29 07:22:19 UTC
I uploaded 2 logs screenshots, one from iPhone and one from iPad, but I don't think the issue is from iPad, because iPad can discover Android and macOS, and I have a Virtual Machine windows, iPad can discover it too, without iPhone, iPad+Android+macOS+Windows are all can discover each other, so the issue is 100% from iPhone.

I tried the AppStore Version on iPhone, it's version is 0.2.1, very old version, it acts the same as the latest one(0.3.0(6)) in testflight(can't discover any other devices or be discovered by any other devices). 

BTW, I can provide online contact(video call) if you are convenient(after your reply, I'll reply you an email, then you can send your private contact way to me via email).
Comment 6 Bruce 2022-11-04 04:29:42 UTC
KDE Connect updated to 0.3.0(8), iOS updated to 16.1, still the same, can't discover nothing.
Comment 7 Apollo Zhu 2022-11-05 10:22:21 UTC
Thanks for sharing the logs, and I believe I've reproduced this bug in limited scenarios that matched what the logs say. I don't think I fully understand the bug yet, but will look into it more.

For devs: I believe the bug is due to LanLinkProvider socketDidDisconnect getting called after onStart. Not sure what exact problem this causes though. Also I don't think refresh discovery should cutoff existing connections, at least based on observed behavior of Android client.
Comment 8 Bruce 2022-11-05 10:26:07 UTC
OK, thanks, I believe you and other developers can fix it.
Comment 9 Apollo Zhu 2022-11-05 10:33:34 UTC
Could you share one more log with https://invent.kde.org/network/kdeconnect-ios/-/wikis/Debug/Options#isdebuggingdiscovery (isDebuggingDiscovery) debugging mode turned on from your iPhone, so I can be more sure about my guess? There should now be several additional debug log entries like "lp onStop" and "lp onStart".
Comment 10 Bruce 2022-11-05 10:49:52 UTC
According my test, the debugging mode will turn off if I restart the app, and I just re-enable debugging mode and searched the log, there's no logs containing onStop or onStart
Comment 11 Apollo Zhu 2022-11-05 16:07:15 UTC
1. Yes, debugging mode will be reset every run
2. Note that isDebuggingDiscovery needs to be turned on separately in addition to turning on debugging mode. I’ll rephrase Wiki later to signify this
Comment 12 Bruce 2022-11-05 16:20:59 UTC
Created attachment 153495 [details]
isDebuggingDiscovery.log.jpg

isDebuggingDiscovery.log.jpg
Comment 13 Bruce 2022-11-05 16:21:38 UTC
Oh, I misunderstood, I enabled isDebuggingDiscovery this time, and yes, there are many "lp onstart" and "lp onstop" in the log, see attachement.
Comment 14 Bruce 2022-12-29 13:47:37 UTC
Is there any progress? I still can not discover any devices on my iPhone.
Comment 15 Apollo Zhu 2023-02-13 18:53:36 UTC
Unfortunately grad school has been quite busy for me, and I realized that the changes needed touch much more aspects of the project than I thought, and even with those I'm not confident if the problem can be fixed because I now somtimes reproduce the issue even when things are working as expected... I know this is not the solution you are looking for, but I think I should let you know what's going on right now. Sorry for not being able to address this more timely.
Comment 16 Apollo Zhu 2023-03-03 18:44:50 UTC
Okay, not sure if this will have fixed it, but I tried to fix as many issues with device discovery as possible, and hopefully it can address whatever underlying problem you are encountering. However, no guarantee though. If you have time, you can try out https://testflight.apple.com/join/N7gQIPan and let me know.

If it still doesn't work, maybe try every possible reset there exists (in advanced settings on both the iPhone and the other clients). If starting from a completely clean state still doesn't fix this, I'm really not sure what will fix it...
Comment 17 Ryan Qian 2023-03-03 19:09:25 UTC
(In reply to Apollo Zhu from comment #16)
> you can try out https://testflight.apple.com/join/N7gQIPan
> and let me know.

Thanks for this new version, I have tested it with iOS 16.3.1 on iPhone.

My iOS device can be found and successfully paired with KDE; sending files from the iOS device to the KDE desktop is also successful. But when sharing files from the KDE desktop to the iOS device, the iOS device does not respond.
Comment 18 Apollo Zhu 2023-03-03 20:10:38 UTC
Great! Then I'll close this bug once the merge request is merged.

In terms of receiving files, I'm working on improvements separately in https://invent.kde.org/network/kdeconnect-ios/-/merge_requests/93 and I'll test to see what's going on with receiving from KDE desktop since I've seen some other reports of similar issues...
Comment 19 Bruce 2023-03-04 06:16:48 UTC
I think I finally found where the problem from, it's because my iOS system language is Chinese, I've switched the system language to English, it's normal now, Kde on my iPhone and Kde on my android(MIUI13.0.11) can discover each other and can send file to each other.

But it still can not discover soduto(kde client on my macOS), and soduto can not discover kde on my iPhone too.

But soduto and kde on my android can discover each other and send files to each other. 

soduto: https://soduto.com/
Comment 20 Apollo Zhu 2023-03-06 19:41:52 UTC
1. In terms of receiving files, https://www.reddit.com/r/kde/comments/x0wipc/on_kde_connect_ios_where_do_files_go_when/imb4y4q/ suggest that you might need to unhide the “on my phone” option to see the KDE Connect folder. I tested with the Qt client and couldn’t find any problem, so I guess the above might be why.
2. I don’t beliebe we have any locale/language dependent code, but interesting discovery, will investigate to see if I can also reproduce
3. Last time I checked with Sudoto it worked okay, will double check to see if anything changed
Comment 21 Bruce 2023-03-06 19:55:32 UTC
weird, I tried switch system language back to Chinese, it's ok too, it can discover my android kde connect, but still can not discover Soduto on my macOS. but android kde connect can discover soduto, so the problem is on iOS version kde connect.
Comment 22 Ryan Qian 2023-03-06 20:01:10 UTC
(In reply to Apollo Zhu from comment #20)
> 1. In terms of receiving files, 
> https://www.reddit.com/r/kde/comments/x0wipc/on_kde_connect_ios_where_do_files_go_when/imb4y4q/
> suggest that you might need to unhide the “on my phone” option to see the KDE Connect folder.
> I tested with the Qt client and couldn’t find any problem, so I guess the above might be why.

FYI, I tried it, but I didn't find the KDE Connect folder or other related buttons under `Files --> On My iPhone`.
Comment 23 Apollo Zhu 2023-03-07 21:04:18 UTC
Tested with Chinese and Soduto 1.0.1 (11), both worked okay... If KDE Connect iOS does have Local Network permission as described in https://support.apple.com/en-us/HT211870 and Configure Devices by IP also doesn't work, I'm not sure what we can do... Maybe try to see if the same issue happens on a different network?
Comment 24 Apollo Zhu 2023-03-08 00:46:52 UTC
Okay, looks like there's a very rare scenario (which I don't know how to reproduce) that the iOS client will send out an identity package with a wrong tcp port than the one currently used. 0.3.1 (3) includes the fix, and hopefully it should now work for you...
Comment 25 Bruce 2023-03-09 13:49:42 UTC
(In reply to Apollo Zhu from comment #24)
> Okay, looks like there's a very rare scenario (which I don't know how to
> reproduce) that the iOS client will send out an identity package with a
> wrong tcp port than the one currently used. 0.3.1 (3) includes the fix, and
> hopefully it should now work for you...

bad news, I've tried switch to another wifi router, but still has the same problem.
still cannot discover soduto on my macOS, even I configure my macOS's IP directly. but can discover my android kde-connect(each other).