Run Xcode Instruments on device with a ios keyboard extension - ios

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.

Related

Why am I unable to export my xcode instruments data as a CSV? The option is greyed out

Currently I'm trying to record the average, high and low framerate of my iOS application by running it through Xcode. I:
Load the project in Xcode.
go to Product -> Build For -> Profiling and build it to my device (iPad 2)
Long-click the play button and select Profile
Select the Core Animation instrument when prompted.
Press the Record button, launching the app.
Perform a 5 minute test. Framerate is displayed in the tool.
Press the Stop button to stop the application.
Click "Instrument" from the xcode menu to attemp to expore.
At this point the option is greyed out with no explanation. Can anyone shed some light on this?
Some instruments do not support exporting to CSV. The Export Track menu item being disabled is a sign the Core Animation instrument cannot export its data to CSV. Disabling user interface elements and menu items is Apple's way of saying you can't do something in Instruments.
If you want to know why the Core Animation instrument cannot export its data to CSV, I have no answer for you. Your best option is to ask on Apple's developer forums. There's a Performance Tools board in the Xcode section. If you're lucky, an Apple engineer may explain why.
You may already know this, but you can save your trace from the File menu. You won't be able to read the data in a text editor, but you can at least examine the trace data in Instruments at a later time.

Logging thread stacktrace when stuck in ios

My app got stuck for 15sec and then released, during this period complete UI got frozen and user can't click on anything. Its a production app and not reproducible in debug mode.
Is there any way to log the thread stack trace when app hangs (similar to ANR for Android)?
You can try to put exception breakpoint to you project / workspace.
Go to Breakpoint tab on left pane and hit the plus(+) symbol on left side.
And then just add exception breakpoint.
Then you can also edit the breakpoint to have it only for Objc exceptions.
You can reveal the reason the app crashes this way but it also can be caused by memory exception etc.
If you won't find an answer this way, you can try to use Instruments. Here is a good tut how to use it. `Ray Wenderlich - Instruments tutorial
Connect your device to your computer. Open Xcode. On the tab bar there is a menu named "Window" select "Devices" option from it. On the left column, you will see your devices. Select your phone. On the same screen there will be a log console which outputs devices logs and user logs (written using NSLog)
To write your NSLog logs into a file you should write a custom method to do that. For this you can see this question there is a few ways to implement it. It'll be useful for you.

iOS: App crashes when pressing record in Instruments

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.

Xcode Instruments not profiling anything

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.

Is it possible to test ready ipa file by instruments

I have an application built in IPA file by Adobe Flashbuilder (with AIR) the app works smoothly on iPad. Well.. worked smoothly until I had encountered some memory leaks. Is it possible to monitor this application's memory usage with Apple's Instruments?
For now I am deploying this app by dragging IPA file into iTunes and synchronize then.
I need to monitor this app. Is it possible? What should be eventually done to make it working?
Yes. you can analyse using instruments.
Install your app in your device.
Connect your device to your Mac.
Open Instruments and select Leaks (you can select any option infact, like Allocations etc.,) in the dialog that appears.
In the Top Left corner, you will see "Choose Target". the first two options are your device and your Mac. Select your device.
In the same menu, the 5th option is again "Choose Target". There you will see all the installed applications in your device. Select the app you want to analyse.
Finally, Press Record, and you will see your app running in the device and Leaks/Allocations (whatever you have selected) being shown in the instruments.
Hope this helps you.
Try running Instruments and select an installed app on your device, if you get this message, you know what's happening
Target failed to run: Permission to debug com.fantageek.MyApp was
denied. The app must be signed with a development identity (e.g. iOS
Developer).
I believe it's possible through the Xcode organiser. It outputs events happening on the device to a log. Don't quote me on that though

Resources