iOS: App crashes when pressing record in Instruments - ios

Regardless of the template I pick in Instruments (Allocations, Leaks, Activity Monitor) - the app crashes right away when pressing record. There is NO stack trace or any warning whatsoever - and after that the Instruments sometimes freezes and needs to be forcibly shut down.
I'm using XCode 6.3.2.
I should also add that this is happening on my device.

I found a workaround.
After installing app to phone via XCode, I kill the app.
Then I go to Instruments and select the app in Instruments and press the record.
This launches the app on the phone and the Instruments work!
Also, the proper way to launch Instruments is by pressing CMD-I in XCode. I was opening it from the developer tools which is wrong.

If you got to 'Window -> Devices and Simulators' you can look at the crash logs on the device in question.

Related

Profiling iOS app with Instruments fails: No allocated PMI record error

I'd like to profile my app using Instruments App.
My app is built without an error. I built it with Product > Profile menu.
After the build is finished, the Instruments app is automatically launched.
I select the CPU Profiler template, and click record button to start the profile.
But the app couldn't even start because the Instruments says that
No allocated PMI Record
What's worse is that after this message, my iPhone is bricked, and I have to forcefully reboot the device.
I've searched the google but there aren't any useful explanation regarding this message.
I'm wondering:
what this "PMI" mean
why this message show up
If anyone happens to have any clue, please let me know.
Thanks in advance!

How to capture crashes if the app crashes on launch

I currently have an issue with my app where it's crashing on launch in some cases for some users in the field, but not in-house. In this case, the whole app shuts down before Crashlytics gets a chance to submit its crash report. How do I avoid this? The Crashlytics delegate protocol doesn't seem to support anything useful in this case - I tried turning off the asynchronous submission functionality, but it did not help. What's the best solution to capture crashes that happen immediately on start-up?
Edit: I am talking about capturing crashes from users in the field, not from my own device.
XCode->(Window menu -> Organizer, or Cmd-Shift-2.) Find your device in the left sidebar, then select “device logs”.
A tool for detecting and repairting continuous launch crash of iOS App
https://github.com/liuslevis/GYBootingProtection

My WatchOS2 app stuck on launch with Spinner

I built a demo app on WatchOS 2.0.1, on every launch it was getting stuck with App name on Top Left corner and spinner in middle of screen on iWatch (38mm). Watch is brand new and have only native apps installed till now so there should not be any issue with memory.
I tried many times to open the app but it was repeatedly closing automatically after showing Spinner for sometime. After lots of trial my Apps screen got visible and then after on every launch it worked fine without sticking on launch. I tried to double check by Force quit my app using Power button but it worked fine then after.
Then I uninstalled the app from watch and reinstalled it and same thing happened again. It started sticking. Do anyone have Idea on this? Please help on this part.
WatchOS Version : 2.0.1
Your app is crashing, as evidenced by it "automatically closing."
You should be able to track down the reason for the crash by examining the crash report (which can be found in the Xcode Window -> Devices pane). Alternately, you should be able to interactively debug this by running the app within Xcode.
As for it eventually no longer crashing until you deleted and reinstalled the app, the app reached a state where the reason for the crash no longer occurred. This probably is related to needing to handle some error pertaining to a path or file which it is finally able to create or access. Deleting the app recreated the condition where it repeatedly crashed again.

iOS: Simulating user quitting app

I just added persistent data into my app and wanted to test it with my iPhone. When I quit my app (double tap home and swipe up), I'm unable to open it again (the icon freezes). When I try the same thing on the iOS simulator in Xcode, it crashes too. I get a SIGTERM error coming from my AppDelegate. Is this what is supposed to happen when the user quits while testing, or is this an issue with my data? Is there any way to simulate the user quitting and restarting the app to make sure my data is still there?
Thanks
This is not what is supposed to happen when the user quits while the Xcode debugger is attached (at least not anymore — this question is a couple years old after all).
If you force quit an app while running from Xcode (whether simulator or on a physical device) it just stops the debugger and you should be able to relaunch it without issue. The Xcode debugger will not be attached when you launch like that, but from Xcode you can attach the debugger to an existing process (Debug > Attach to Process).
Note, if run in Xcode and then you quit the simulator application on your Mac (or close the simulator's window) then you will get a SIGTERM error in main.swift. But this is not the same as a user terminating your app, nor is it comparable to a user turning off their device.
From what you're describing it sounds like there is a bug in your code that is causing it to freeze when launching when the debugger is detached or when it's relaunching after termination.
To simulate the user quitting and restarting you should be able to terminate the app from your device/simulator, and then either run it again from Xcode or launch it from the device/simulator and attach to the process from Xcode.
In some cases it may be helpful to put in some debugging code that pops up an alert / update some label at runtime to indicate the data persisted properly after the app re-launched so that you don't always have to have Xcode attached to diagnose problems in your app.
This is the correct behavior if you are running the app from Xcode. However, once you've uploaded/run the app once, you can test closing and reopening it. Simply stop the run in Xcode, go to your phone or simulator, and click on the app icon to open it. Unfortunately, you won't have a debugger log at that point, but you can see if your data persists.

XCode & Instruments, how to clear the list of processes

I'm debugging an iPad app and I'm getting a GIGANTIC list of processes to attach to when selecting the "choose target" drop down in Instruments.
It's literally showing every single process that I have run and terminated when I start and stop my app that I'm debugging. They are listed under the Attach To Process->System section, that's where my IOS apps to debug always show up, but they never get removed, so I have to dig through hundreds of entries.
I've tried restarting xcode, instruments and IOS simulator... Is there any way to clear this without restarting my mac? I'd hate to have to do that every time.
Everytime you exit your app in the iOS simulator, it creates what is called a "Zombie Process". To this date, the only way you can clear these processes is by rebooting your mac.
Also, when you want to choose a target for your Instruments application, the process you will want to select will most likely be the highest-numbered process for the app you are currently testing.
Here is a stackoverflow reference regarding the zombie processes left behind by XCode: Xcode leaving zombie processes after running iOS tests/simulator

Resources