All UIView animation / transitions becoming non-animated after a while? - ios

I have a strange issue both on mobile device and in simulator.
After a while spent in the application, animations on UIView are disabled (like if animated was set to NO), notably on :
pushViewController in a UINavigationController (also true for popTo)
displaying a UIActionSheet
switching between views with IIDeckViewController
This is quite strange as all transition are usually animated, and in a non predictable way, they all become non-animated
Everything was working well a few days agos, and as far as I can remind, I did not make any changes that should lead to such a behavior.
Any ideas ?
Thanks
Cheers

We recently had some trouble like this, the culprit was initiating some animations from a non-main thread (perhaps you are initiating a transition). This caused some trouble with animations transactions getting rolled back and this broke animations until the transaction was rolled back. There were some entries on the console pointing to CA transactions. Setting CA_DEBUG_TRANSACTIONS=1 on the environment quickly revealed the stack of where the the transactions were started.
The fix was to not do anything that would create transactions from a non-main thread.

Related

iPhone UI Updating while Xcode paused at breakpoint

I have an odd UI bug I am tracking down, where my UI in a particular UIViewController subclass shows up mostly ok and then animates itself to be totally ok.
I have tracked down where the "shift" is occurring, but have not yet completely solved the issue. While attempting to track down and fix the bug, I had a very, very odd thing happen.
I set and hit a breakpoint in -(void)viewDidAppear:(BOOL)animated for the UIViewController in question. When the breakpoint was hit, the UI on the attached phone was wrong. Then, while still on the breakpoint, without me taking any action, the UI performed the "shift" to correct the out-of-position frames.
How is this possible? Shouldn't -(void)viewDidAppear:(BOOL)animated fire on the main/UI thread? If so, how is any adjustment being made to the UI while paused?

iOS unknown delay between animationControllerForPresentedController and animateTransition

I'm having an annoying issue with a custom transition using UIViewControllerContextTransitioning when triggering the animation from a tableView
I followed many tutorials out there, to name a few :
- http://www.brightec.co.uk/blog/ios-7-custom-view-controller-transitions-and-rotation-making-it-all-work
- http://objectivetoast.com/2014/03/17/custom-transitions-on-ios/
This is the exact problem I have (but no solution :/ ): Custom transition animation unknown delay between animationControllerForPresentedController and animateTransition
Sometimes it works, sometimes it's just to slow.
I don't know what happens behind the scenes between animationControllerForPresentedController and animateTransition. If you have an idea on how to debug that I'd like to hear it.
Even without seeing your code I'm pretty sure you having a main thread issue. (see http://www.raywenderlich.com/31166/25-ios-app-performance-tips-tricks#mainthread - understand that, both about not blocking the main thread and always doing UI on the main thread.

iOS 7.1 animation bug

Yesterday I updated my iPhone 5 to iOS 7.1 and found a strange bug in my current application. There is few UINavigationControllers. After few transition in it the animation of transition become to fast, like there is no animation at all. But more strange that all system animation became to fast, default UITableCell animation, modal window animation and so on.
Does someone know what is this? On device with 7.0.6 there is no such problem.
Looks like it starts to happen after few calls of:
[navController setViewControllers:popViewControllers animated:animated];
PS: One more thing - my app is still using iOS 6.1 SDK.
PPS: i don't use custom default animations.
UPDATE: With 7.1 SDK problem still exists.
I have similar problem after updating my iPhone from iOS 7.0.3 to 7.1. I go back and forth several times using the navigation bar and after a few tries there is no transition animation. All animations are broken when it happens, eg. device rotation animation. After reaching this state, few more back and forth transitions cause a crash.
Edit 3:
In my case the problem was because of accessing GUI objects from a background queue. If you experience this issue make sure all GUI objects are accessed from the main thread. Many thanks to Eugene for helping me figure this out.

Animations disappear in iOS application after some time

After several minutes running all animations in my application disappeared, even system animations like alert animation and UINavigationController animations. What can be the issue?
P.S. I dont use [UIView setAnimationsEnabled] anywhere.
Well, the answer is - system sometimes disables animations, and, normally, it enables them back on. But in my case, for some reason, it failed to set them back enabled. And this happens only during transitions between UIViewControllers. What I came up with, is to reset [UIView setAnimationsEnabled:YES] after every transition.

Gesture response slows with use

I am using UIGestureRecognizer to detect taps or swipes and change page in my app.
After some use (perhaps 50 odd page loads) the app starts to respond noticeably slower to gestures. You can tap and wait a full second for the gesture to be recognised.
I have checked my code and it is not the page turning that is slowing down, as that still works by other means (bluetooth keyboard). Also the response of buttons and menus does not slow down.
Does anyone know what might be causing this? It eventually causes the app to become unusable.
There could be quite a few things. The first thing I would do is run instruments against the app and look for leaks. A slow down like this could be caused by objects being created and not released. Also note that the leaks instrument does not pick up everything. I've often picked up on objects leaking by looking at the allocations and checking that the correct number of instances are alive.
Problem solved! It turns out I was adding new gesture recognisers each time a page was loaded without removing the previous ones.
I was having this slow segue problem, only when swiping for the segue. I came to this thread and saw the post from #colincameron saying that he was stacking gesture recognizers with each load.
So I went and found this SO thread, where #robmayoff shows how to remove all gesture recognizers from a view. You could add this removal code to your prepareForSegue, viewDidDisappear, etc
Swift
subview.gestureRecognizers?.forEach(subview.removeGestureRecognizer)
That code solved my slow segue problem.

Resources