Apple Watch Program ended with exit code: 0 - xcode

I'm using Xcode 8.1, Swift 3.
I'm making a custom watch face for the Apple Watch (For myself).
So i set the watch to always show last app on wake, and after sometime i noticed that it get back to the default watch and my app is closed.
For a week now I'm trying to figure out why the app keep closing.
On Xcode i tried to debug the WatchKit Extension and after some time the console just print: "Program ended with exit code: 0" and the app closed again.
I looked on google to check if WatchOs have timeout for apps and didn't find out anything about it.
Also the app is sometimes closed after 5 min and sometimes after 12 h...
The app is never pass the 1.5MB memory.
Any idea what could possibly cause that?

I faced the same issue while working on an app.
In my case I'm using SpriteKit scenes which take a lot of memory for rendering to it causes the crashing of the app on watch.
Do check the memory consumption of your app. Make it under the bar to test it on the device.
Try to remove the elements which you think of taking a lot of memory. Use Instruments to track them.
NOTE: It will run successfully on Simulator. But on the real apple watch it crashes.

App will quit after 8 minutes if it is not in the dock, this is explained in WWDC16 videos, other bug might be similar to this:
Watch App terminates upon deactivation if WKAlert is being shown

Related

Xamarin - How to see the iOS Simulator app log

I recently upgraded some Firebase packages in my iOS Xamarin app, and now the thing refuses to work. The app opens (shows a splash screen) and immediately closes without producing an error.
While I want to fix the package problem, I have no clue where to start. I set a breakpoint on the App.xaml.cs constructor, but this never gets hit when I run the iOS version. So my next idea was to read the output like I do on Android.
I've been Googling around for a few hours, and everyone seems to say 'Go to Debug > Open System Log...', but this is absolutely rubbish! The system log seems to show everything except for my app running... (E.g. I run the app in the simulator, reload the system logs, and the freshest thing is from 10 minutes ago...)
I'm at my wits end here. Does anyone know a trick for viewing my app output in the simulator? Even just an exit code would be useful 😥
You could view the logs in these locations:
Mac – ~/Library/Logs/Xamarin/Simulator.Server
Windows – %LOCALAPPDATA%\Xamarin\Logs\Xamarin.Simulator

Nativescript Angular iOS crashing after splash screen (started randomly)

Today, randomly, my app stopped running on iOS anymore. I have been working on it daily for weeks and nothing has changed this morning. Works fine on Android. On iOS it shows the splashscreen like normal and then just quit out. There are no errors shown in the console. I am using Sidekick cloud build for iOS. I am running on a physical device. In fact it does not run on my iPod, but it will run fine on my iPad.
Has anyone had this problem? Is there a reason no errors are visible?
SpringBoard: Forcing crash report of (reason: 1, description:
org.nativescript.myapp failed to scnene-create after 4.77s (launch
took 15.23s of total time limit 10.00s))
Found some insights for this and looks like it is crashing because you are spending too much time doing CPU work on the splash screen.
iOS will kill your app if it takes it too much time to load.
The crash report for this would have an exception code of 8badf00d(this is in Hexadecimal) and it will also say “failed to scene-create in time”.
That is exactly you are also getting.
So try not to load to my things on app initilization and get away from Splash screen as soon as possible.

Proper way to debug watchos2 app in XCode7

I'm rewriting my watch app to work in watchos2 but have problems debugging on the actual watch (XCode7). What is the correct way how to do this?
1) Obvious (but naive) approach - connect your phone with paired watch, in XCode select Extension scheme to run on Phone + Watch. Click play and it should work, right? This seems to work only just after fresh pairing and breaks very quickly (after few debug runs). See issues and behaviour below
2) Run phone app first then add run of extension - this approach worked for me longer but eventually broke as well.
3) Unpair and pair again - more than painful experience, time consuming and not practical at all. Will help for a while though.
Main problems:
phone app not communicating - I've seen not reachable or messages just time out
watch app stops running - XCode is saying it's running but it's not - won't even attach. If I run it manually on watch most of the times it will attach but then the phone app is not reachable
watch app won't even install - I suspect when the XCode is saying it's running it in fact it doesn't because when I remove the app from watch and then run XCode goes through the whole install process and "running" but the icon doesn't even appear on the main screen
phone stops reacting when I use option 2) and try to run something else while app is attached
phone seems to be blocked, selecting other apps (even going back to my app) won't work until I kill the session
Setup: The phone and watch is paired correctly, phone can see watch, watch can see phone, other apps are working. Watch "trusts" the computer as well, app is "shown on apple watch". Phone is 5s 9.0.1.
I've tried various restart combinations (phone|watch|xcode|mac), shuffled cables, disconnect, reconnect, etc. but that didn't help either.
Did anybody find a usable way how to debug watchos2 app from XCode? Nobody else seems to be complaining about this with released XCode7 though I've seen lots of similar issues in beta builds.
Use Apple watch recharging cable, connect your watch to developing Mac that runs Xcode.
It provides much more successful and fast debugging.
I have been dealing with the same issue this last days, I just updated to iOS 9.2, watchOS 2.1 and XCode 7.2, and now everything works.
After update XCode to 7.2, iOS9.2 my phone and WatchOS2.1 my Apple Watch the debug process is better. I suggest to update all your devices.

Running the app on a real Apple Watch and infinite spinner

I wanted to make a clickable prototype of an app on (storyboard only). I have just added two interface controllers and some images and buttons. I filled xcassets with several images (overall less than 150kB) and tried to run the app. When there was a single interface controller with 3 buttons (images in background) + 1 imageView (around 100kB all) it took some time but the app lauched. I added 1 more interface controller and a few images to it (the biggest are around 9kB) and this time Xcode displayed me a message that it lost a connection with an iPhone but the watch is still running or the watch app timed out error. At the same time I have the app name on the watch screen and a spinner. And it's spinning for ages without any result... I've tried to delete the app from both devices, restarting, cleaning folders etc. and no success. Is there a limit of images one can put in the watch's xcassets? So frustrating...
I was also facing same issue where spinner on real devices was never ending.
This was because watch extension and watch app were missing arm64 architecture, make sure you select Standard Architectures(armv7 and arm64)in build setting.
Here is what you could do/check:
You should use the xcassets that is located in your WatchKit app, not the one in your WatchKit extension.
Build and run your main iPhone app as the primary target once.
Yeah, i've been struggling with this too...
the only way i found : i click on digital crownd of the AppleWath, then re-tap on my app and magically the app launching (and the debugger work.)
if this is not working the hard way : Reboot xcode, Clean, if still not working same as you clean, restart devices... this is so annoying.
first solution take less time, and work 7/10 times
if someone knows a beter solution i'll take it !! ;-)

Couldn't register "Application" with the bootstrap server [duplicate]

I keep getting this error when launching my app on the iOS Simulator:
Couldn't register com.mycompany.MyApp with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.
I've read other reports of this error and it seems there is no obvious fix for it (restarting the iOS Simulator, restarting Xcode etc..)
At this point here's a list of things I've tried:
Restarting the Simulator
Restarting Xcode
Rebooting my machine
Deleting my app's Derived Data, and Cleaning
Deleting the iOS Simulator App Support directory
Reverting to a 2 weeks old version of the app (which was working 2 weeks ago)
Deleting the application in the Simulator (by clicking-holding on it and hitting the X button)
Upgrading Xcode form 4.1 to 4.2, and running the app both in iOS Simulator 4.3 and 5.0
Nothing worked, I still get the same bootstrap error.. Any (and at this point I really do mean ANY) suggestion would be appreciated.
Edit: Just wanted to add that the app runs fine on a device. I only get this error on the simulator...
As the GDB said:
This generally means that another instance of this process was already running or is hung in the debugger
So find out it and kill it. ;)
I restarted the mac, and it run successfully.
Tip: Well, this may be not work sometimes, so I strongly suggest that you press cmd+. to make sure that you do have stopped the simulator (or device). I find that in most cases the simulator (or device) will not stop exactly when it crashes. I rarely met this issue again with pressing the cmd+. every time it crashes or even just normal exit. Hope this will be helpful. :)
I just closed my xcode & restart my device(ipad2) and it works for me :)
You can try this :: Couldn't register with the bootstrap Server
Another solution, go to clear the memory of the iphone simulator
Simulator > recovery content and setting
then run the program again.
i just change the identifier and the app can work again.
I had to change my bundle identifier finally
No matter you reboot all devices and cleanup all , it gets stuck hard in the debugger..
don't know how to clear it..
As I experienced, device (or simulator) restart does solve the issue,
BUT it would be better not to couse it.
Also my experience is that:
You can find the place of crash by cousing it. In such time developers usually press "STOP the running scheme" this could cause zombie process stuck in device.
BUT
if you press "COUNTINUE program execution", debugger will terminate the process, it will not become a zombie.
I had this error too and I noticed that it works for me if you close the simulator and stop the program and then change your company name.
I don't know why but it works for me.
I opened Activity Monitor and searched for my app name, and found another instance of it listed. I used Activity Monitor to quit that instance, and the problem went away for me.

Resources