Apple Watch App "extension continues to load" - watchkit

I've had an Apple Watch App hosted in an iOS App rejected for:
"We discovered one or more bugs in your app when reviewed on Apple Watch.
Specifically we found the watch extension continues to load indefinitely on launch."
In the simulator and on the watch itself (iOS 9, WatchOS 2, xCode 7.01)
None of the visible routines are repeatedly called, and I can't find a starting point to debug this.
The watch app has no notifications, no glance interface, and has a single story on the storyboard. It does contain a WKInterfaceTimer which I "stop" and "start" on activate and deactivate, but of course the underlying timer is not stopped or started. I don't even know what they are seeing that causes this report. So tough to debug. Any ideas?

That's WatchOS bug. See related discussion on ADF.

Related

Xamarin Forms - iOS debug on actual device hangs on launchscreen. Workin on simulator

I have a XF app already published on the play store and now I am targetting iOS. During developpent I made sure the app was still working on iOS, using the simulator only.
On the simulator everything works as expected, the launch screen is shown then the MainPage starts. But when I debug on an actual IPhone device, the app get stuck on the Launchscreen.storyboard for about 20 sec then the app exits. I've no debug output and it seems that the AppDelegate is never hit. Breakpoints in AppDelegate.FinishedLaunching method are not hit for instance. I tried to F11 for start in debugging mode but I don't hit anything, still hanging on the launch screen. I was expecting the transition from simulator to device to be less painful.
My plist file contains the following permission requirements
...
<key>NSLocationAlwaysUsageDescription</key>
<string>We need to use your location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We are using your location</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photos.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app needs access to the photo gallery.</string>
The only difference I saw is that location permissions are not asked on the device while in the simulator it asks for it at start. But this might be related to the fact that I can't reach AppDelegate, I am not sure yet.
The iOS project was generated via Prism templates. I am using VS 16.8.0 on Windows, XF 4.8.0.1687, Prism 8.0.0.1909, Xamarin iOS SDK 14.4.1.3 and I am set to "don't link" for linkers option. The device is an Iphone 10.
Any idea how can I find out the root cause - or get some useful logs?
Thanks in advance for your help.
EDIT:
Here are the device log output during a new installation https://taits.s3-eu-west-1.amazonaws.com/devicelogs.txt. I am trying to go through them but kinda lost.

Connection to daemon was invalidated

My app is using Firebase Analytics and I believe starting in iOS 13.2 started getting the errors described here: Why I get the console warning: [Process] kill() returned unexpected error 1 when I load a WKWebView in iOS13.2?
I guess it wasn't a big deal
Since I planned for my app to go live in January, I began bigger tests in physical devices. I noticed after a while the app started to behave erratically, specially after receiving a [general] Connection to daemon was invalidated error. This doesn't occur in the simulator
Searching the internet I found a post that describes the same problem: https://forums.developer.apple.com/thread/124306
In my case, only Firebase seems to be calling WKWebView, but every time I open the UIMenuController I get the error described in the console and the app appears to be missing inputs. This is specially troublesome with UIScrollViews, which my app uses a lot. The pinch gesture seems to work at will. On an iPhone 6s, the issue isn't as noticeable, on an iPad, it's like a 50% chance the pinch gesture will work properly
Outside of removing Firebase, is there a way to mitigate this issue?
1 June 2020: The console message still persists, however, I have seemed to resolve the UIScrollView issue by deactivating delaysContentTouches, now the pinch gesture seems to work most of the time
23 October 2020 If anyone notices their app starting to behave erratically with no apparent reason I HIGHLY suggest to test it on an iOS 13 physical device if possible. Seems that Apple removed the warning from iOS 14, but testing it on iOS 13 you can pin point the exact reason after the warning appears in the console
Upon further testing, I've reduced the view down to a dead-simple UI view with a single SwiftUI TextField and the 'Connection to daemon was invalidated' still appears after I type the first character into the field. Soon thereafter the app crashes with a sigAbort. (So I don't think the reason is the UITextView wrapper I was using in the previous post). Once the invalidated message appears the app is doomed to crash, not right away but soon thereafter.
I have no idea what causes the 'invalidate' message and a Google search seems to imply that no-one else does either. Some folks appear to have made (experimental?) changes to their UI that stops the message but it appears to be impossible to determine a definite cause. (and like before it only occurs on a real phone)
Same issue without using Firebase at all. What I did: Delete build folder and compile again. Issue does not appears again.
On Xcode:
Clean the Build Folder
This will delete all of the products and intermediate files in the build folder. To clean the build folder you can use the shortcut Command+Option+Shift+K or Menu Bar → Product → Hold Option Key → Clean build Folder.
On Flutter:
Just delete build folder.

watchkit extension 2 iOS app crash at start in simulator

I have configured the WatchKit App to run in my project (WatchOS2).
When I try to run it into the simulator the WatchKit App start perfectly, but each times I'm trying to start the iOS app, this one crash.
The simulator's log show me that :
com.apple.CoreSimulator.SimDevice.5F243C10-E98D-4A20-8950-2742FE6CABD5.launchd_sim[13288] (UIKitApplication:com.MyCompany.MyProject[0x847][13496]): Service exited due to signal: Trace/BPT trap: 5
All of my code in the application delegate is in comment. just enough to start
If I build and use my main app target with the same simulator setting, that works nicely. it just when I build and run the watchkit extension target.
I tried to clean everything (derived data, simulator setting and contents).
I know, it is not the simulator, because with a new project, the issue is not here. it might be something set somewhere ??
but nothing works, any idea ?.
Your application aborted, likely due to a failed assertion. You should look at the crash log (in ~/Library/Logs/DiagnosticReports) for more details.

Why can't I run my WatchOS 2 app?

It runs just fine on the iPhone. When I select the Watch App Target, however, it simply won't run on the watch.
I don't get any errors or anything. I can see the app downloading on the Watch sometimes; when it does download, it deletes itself the moment the download is complete.
I've tried uninstalling the watch app and reinstalling via the Apple Watch app on the iPhone, and the same thing happens: it downloads and deletes itself before I can run it.
I've also reset the watch, reset Xcode, deleted the iOS app, and just about everything else I could possibly think off, but I'm starting to lose my mind.
The problem started happening when I (attempted to) set up the Watch Connectivity framework. I don't know if this is related. I've been unable to verify that WC is working properly as I can't open the app.
I've been lucky enough to get it to actually load on the watch only a few times since integrating WC framework, but even when I have, all I got was the loading screen for about a minute each time.
UPDATE:
I'm now seeing some consistent behavior.
I'm now able to debug my app by launching the watch app via Xcode. The app icon does not appear at all on the watch when this happens, however. (Weirdly enough, it shows the launch screen for a different watch app when launching.) So I can't run the app at all unless it is launched from Xcode.
Also, I am not able to download the app to the watch via the phone. I want to be able to run it outside of debug mode, and I can't. When I attempt to install it from the Apple Watch iOS9 app, the install begins, I see the icon on the watch as it downloads, and just as it finishes, it deletes itself from the watch before I can run it. This just keeps happening.
Please help!
Make sure your Apple Watch device ID is in your provisioning profile.
So, this kind of sucks as an answer, but I've had enough.
I decided to copy all of my code and storyboards into a new Xcode project. The Watch App now works exactly as it should. Hopefully Apple sorts out these bugs in an update.
I believe repairing the watch would help as well. I had the same problem before and the only thing which helped was repairing the watch.
I also have other issues debugging the watch app properly - see my question here Proper way to debug watchos2 app in XCode7

App won't uninstall from Smartwatch 2

I've deployed an Android app that interfaces with the Sony Smartwatch 2, and generally, it's working well. However, I have a user reporting that when he uninstalls the app from his phone, the watch component is not uninstalled.
I understand that the un/installation of the two should be linked, and in my testing (and for most of my users), that works fine. What might this user try to force the app to uninstall from the watch?
The user could be right. I've observed the issue only once for ca. twenty (20) installing/uninstalling rounds. However I did not found the way to reproduce it and I can't state what circumstances can cause such behaviour.
Did you've got information from the user on what phone, Android release, Smart Connect or SmartWatch 2 software version this issue occurred?
The only thing he can do to remove Wearable Widgets instance from SmartWatch is to reset the watch (Settings -> Reset SmartWatch).

Resources