iOS debugging with instruments - lag in real device - ios

I am using Instruments (for the first time) as I am trying to debug a lag time arising on a real device but not on the simulator. I have collected some data but I am stuck now since I don't know very well how to interpret them.
Briefly, when I try to present a presentationController in my app I am faced with a lag time (about 5 sec) before the UIView appears on screen. I want to display a UITextView with attributed text. I registered the process with Instruments and here is what I can see (4 figures):
All I have understood so far is that there is maybe a problem with Core Graphics and Font. Could anyone help me to figure out what is going wrong and how I could get rid of this problem? I can give more code if needed.
EDIT:
This is what I obtained when applying the advice given, but I can still not figure out how I can refer those lines to my code.

You want to click these check boxes at the bottom of the time profiler:
from:
http://imgur.com/j0anIdf
to:
http://imgur.com/8PFU5VX
Now you should see your calls rather than all calls

Related

Lost Connection to Ipad error while taking photos

I am trying to add images using the camera in iPad, I am able to add max 30 images and when I am trying to add the 31st or sometimes the 32nd image, when camera opens I am getting an error like "Lost connection to iPad". I tried with allocation, memory is increasing up to 120MB while taking the pic. The images are saved to core data, but I am resizing the image to 600x600. Anybody have any idea about this issue or can you give me a clue so that I can check the reason. Please help me.
Alright, do you get the same behavior on simulator? If you don't, maybe try testing with the iPad fully charged, that will avoid any power supply bug (always happens with my iPad Air).
You said RAM is increasing up to 120MB while taking photos, how does your resize image method looks like? Test it without that method and see if memory goes down, and if it does, just don't use that method.
Also, check for memory leaks, deallocate everything you need and never keep strong references alive when you do so.
I hope that helps you somehow!

ios - iOS 7 UITextView is slow after typing lots of text

I'm having trouble with a slowdown that occurs in UITextView on iOS 7 when typing lots of text. I put a tracer in NSLayoutManager and identified that drawGlyphsForGlyphRange runs N*2 times, where N is the number of times your lines word-wrapped.
Here is the sample code:
https://github.com/philipkd/UITextViewSlow
To reproduce the problem run it on an iPad and attach a physical keyboard. Mash the letters and the space bar for about 15 seconds, and notice it slows down. Then when you try to type normally, it's really slow. That's an extreme example, but if you just try typing two paragraphs at a reasonable speed, it'll jam up.
This is not a problem with UITextView on iOS 6.
Turn off Background App Refresh in Settings General. Also, get rid of NSLog--they slow down beyond what it takes them to print.
I was able to reproduce the slow down effect on iPad under IOS7. In fact IOS6 did not have Background App Refresh.
I believe Apple aims for top of the line models, all others have to adjust.
Is the slows down happen when you plugged in (Xcode debugging) your ipad to the macbook/iMac? If yes, try to unplug the cable and try it again with the cable unplugged, see if it still slows down or not. If not, then it only happen when debugging process. (It's just my guess, since I'm not owner of an external keyboard)

Flash text disappearing when using draw method

Working on an AIR iOS app and noticed a strange thing.
In my app I have a navigation panel that displays over the main content-holding Sprite. Having this panel display was causing the app to crash on iPad1 (guessing too much memory). So I added a function to basically draw the content-holder Sprite (via BitmapData draw function) into a Sprite above it, and turn the content-holder visibility off. Basically, taking a screenshot.
However, I'm seeing on 2 different iPads now that any dynamically added text in the content-holder isn't being drawn. Sometimes, the first time it does, but not after.
One thing noticed is that turning off the cacheAsBitmap property of the text fields fixes the problem. Unfortunately, that is not an option as the app is very text heavy and the performance is noticeably slower if the dynamically generated text isn't bitmapped.
Any ideas on what may be going on?
Thanks in advance for any help.
-Mark
Looks like cacheAsBitmap on the dynamic text fields was the problem. By turning that off temporarily, taking the screenshot and then turning back on when done with screenshot, I was able to work around the issue.
Not sure if it's an AIR/iOS issue or maybe a lack of memory?
FYI, in case somebody sees similar problem. Hope that helps.

IOS Orientation fix doesn't work all the time

I am developping a swipe gallery for mobile devices. Users can change images by sliding the screen, as any normal images gallery in most iPhone app.
Here is a demo:
http://daviddarx.com/stuffs/work/custom/swip/
To debug the iOS orientation bug (which let the content zoomed when you change the orientation), I used the only library that correct that:
http://scottjehl.github.com/iOS-Orientationchange-Fix/
Unfortunately, this library is working perfectly most of the time, but it happens to fail and not work correctly. This happen around 1 time on 10 times, and the result is then the same as if the library wasn't here.
This is not a huge problem on most of the mobile and responsive website, as the user can manually dezoom and then get back to the normal display.
But the problem here is that I had to disable the zoom function, to make my system work correctly. So, when the bug happen, once on 10 times, the gallery is then just bugged and stay like that....
So, here are my questions:
-do you know any other library that manage that bug fix, and is 100% completely reliable?
-if not, do you know a way to correct the used library to get a 100% support rate?
-if not, do you have any idea or solution for me?
Thank you in advance for your help!
David
There's an outstanding pull request on Scott Jehl's repo that uses slope detection instead of absolute values which seems to not suffer from the intermittent-ness of the original solution.
https://github.com/PeterWooster/iOS-Orientationchange-Fix/

UIScrollview is Not Scrolling Properly After Application is Entered Background

In my application i have 3 scrollview, once the application is used for long time or application is in background for long time. Scrollview in my application is not scrolling properly and it is responding very slow compare to previously when the application is installed.
I tested the application using instruments but i am not able to find out the real cause of the application. Please help me in this issue?
Hy this is gues work,
without more details one could only take a look into a glas bowl,
based on my experience scrolling has no general problems so it has to be your code which causes this problem.
I could only advise you to check your state, may adding some Log statements to show the state of your scrolling brings more light into the problem?

Resources