Xcode Instruments not profiling anything - ios

I have just started out learning how to use Instruments with Xcode. Straight out of the gate, for some reason it's not profiling anything when using the Time Profiler.
I have cleaned my project, re-built, most of the obvious things, but I'm not having any luck still yet.
It runs the app, and the timer runs, but nothing happens beyond that. No stacks show up or any data of any kind. Just stays blank.

could you try this?
Start debugging your app with xcode in iOS simulator
Open instruments, then select iOS Simulator/CPU category and choose 'Time Profiler'
Change the Target combobox, All Process/Attach to Process
Look for your app in the displayed list and start record.
This image is an example, I'm attaching time profiler to my Calculator app:
I hope this help you.

Related

Run Xcode Instruments on device with a ios keyboard extension

I'm developing a custom keyboard but it's very slow and sometimes it's crashing.
Because I'm not sure where it comes from, I'd like to Time Profiler with Instruments. But when I select MyIphone > Keyboard Extension (target), I get:
Target failed to run
or
Waiting for x.x.x.Keyboard
Please take appropriate action to initiate the launch of 'x.x.x.Keyboard.'
Is it even possible to use Instruments with an app extension? If yes, how should I proceed?
I can't use Instruments to analyze my keyboard before, however my method might be helpful to you.
Run the project on your iPhone.
Xcode the left column, the seventh button 'Show the Debug navigator', select the 'Memory' column.
In the right 'Memory Report', select 'Profile in Instruments' in the upper right corner. Instruments will open.
I used this method to enter the Instruments tool to analyze the memory. I noticed that the software name displayed on the Instruments tool was followed by a number, like com.xxx.xxx.keyboard (4489).
Accessing Instruments directly from Xcode->Product->Profile does not work properly. This may be the key.
Hope this helps you.

App freezes several seconds before start on device

I'm a free developer and I use my swift application on my iPhone 7. I'm using Swift 3 and iOS 10.
So the problem is, sometimes (like 2 of 10 times) when I start the app, iOS freezes like 5 seconds before my app actualy comes to the screen. In this time I only see the app icon is in the highlighted state. This only happens with my own app, not with other apps.
My app also does nothing special on startup and this only happens on the real device, the debugger in Xcode always starts immediately.
So is this a normal behavior? And does it work properly when I decide to put it on the App Store?
Thanks in advance.
I have had this happen to me before. No, this does not happen when it is put out on the App Store. One way to get around this is to use TestFlight. You can upload your archive to apple and select on the 'TestFlight' tab of your app. Click on internal testing and then click on your email and the version of the app you want to test. You should then get an email on your Apple ID telling you to test the app, and it will let you download it. Good question :)
To test the same version which would have been uploaded to the store quickly, change the build configuration to release. To do so, click on your app's name (top left), press edit schema, click the build configuration dropdown, also deselect debug executable. (make sure to turn it back when you're going to debug, or create a new schema with the above settings to let you switch quickly in the future)
You might also try using instruments, that lag on startup might happen if you're trying to load many things in memory on your initial view controller's viewDidLoad or app delegate's didFinishLaunchingWithOptions load, especially when trying to load big files such as images, videos or large plists. You might want to try using instruments (the time profiler instrument specifically) in order to check it out.

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

IPad - Crashing with no apparent reason

I know it's a bit weird but I have no code at all to put here, unless I copy all of it.
My project is crashing with no apparent reason. I've read this solution: iPhone application is crashing and not leaving behind a .crash log file
and I'm using Instrument for searching for leaks and other possibilities for those crashes.
Another strange thing is: even when I run my app with debug on XCode, it just stop to work on my IPad but it looks it is still running.
And the last and more strange thing: there's no crash log at all on my device. Before somebody ask, it is enable to record crash logs.
Does anybody have any idea for helping me?
Regards
I've had this happen to me before on various platforms. If its crashing on you, whether its an iPhone app, openGL / DirectX program, try these steps:
Have you tried to undo your last change and get to the point where it last worked?
Have you tried placing a print outputs to the terminal to see how far your program is executing? Start at the beginning and work your way into your program. This is especially useful when there is no crash log.
Also in particular to iPhone apps: Have you checked your xib's? Did you recently re-factor and change the name of a class maybe? You might need to re-link your nib to your classes. This on more than one occasion has caused apps of mine to crash with no error. Hope this helps.
I doubt you are still wondering about this, but my answer is that you were experiencing your app getting killed by the OS due to using too much memory. This will silently fail in the log in my experience when running on the device.
You will have to go into the Organizer to the device console and crash reports that get stored on the device to see the clues.
The reason your crash stopped when you got an iPad 2 is because the iPad 2 has twice the memory of the iPad 1 (which is dramatically under-stocked with RAM)

Instruments gives me 'SessionInactive', when trying to measure MemoryAllocations or MemoryLeaks on an MT app

when trying to analyze an MonoTouch app using Apple "Instruments", it
gives me almost always after 4 seconds:
"Device Connection Failed"
"Failed to start Instruments daemon for 'iOS' on 'XYZ' (v4.3.3)' (SessionInactive)
"Please reconnect the device"
What am i doing wrong?
Is it, that my app takes too long to start up.
Or do i need an special build type to allow Instruments to connect?
One time i was able to have "MemoryAllocation" running stable for more than 4 seconds.
Thanks for any hints
I am having the same problem. It happens when I try to run the Leaks instrument, which requires the Allocations instrument, I guess. I can run the Leaks instrument without the Allocations instrument without any problems, but then I can't get the the information that Allocations provides like from what method the leak originates.
I haven't been able to find much about it.
EDIT: I don't know if this is what fixed it, but I killed the app instance that was running on my iPad and then ran instruments again. I did not get the failure with "SessionInactive" and it seems to be running fine now.
I also found a similar topic on the Apple Dev Forums. It didn't really help me, but it might help you.
EDIT 2: It's not perfect. It only runs for a few minutes, but it's better than not at all.

Resources