+[CATransaction synchronize] called within transaction
Asked Answered
H

2

36

If I close my iPad app while I'm loading data from services, the app closes but then immediately opens again without my doing anything. At this point, I am not able to do anything; I can't close the app and I can't interact with the app or the device. The only way to use the device again is to restart it. The app does not crash, it simply disables the device.

When this happens, the following line appears in the console three times right after applicationWillResignActive and applicationDidEnterBackground:

+[CATransaction synchronize] called within transaction

It'd be almost okay if the app crashes, but the fact that the device is rendered completely useless is a huge problem. If I could intercept this bug or somehow detect when CATransaction raises this issue, then that'd be fine.

Any ideas?

Harpoon answered 25/8, 2011 at 19:38 Comment(3)
did you find a solution for your problem?Posology
i have the same problem, did u find out the reason?Milkandwater
Have you found any answer? I can't seem to find any on the net and all my tweaks and try outs fails. this [CATransaction synchronize] still blocking my main thread.Farmhand
T
13

This happens when more than one animations are taking place on main thread. I faced the same problem. In my case application freezes while animating the CALayer and rotating the device simultaneously. So I stopped the animation while rotating the device.

Look for the code

[CATransaction begin]

//foo
[CATransaction commit]

Make sure that animation inside this code does not overlap with your other animations on main thread.

Tsarevna answered 25/4, 2012 at 5:17 Comment(2)
is that meaning i have to do this in all commitAnimation? [CATransaction begin]; [UIView commitAnimations]; [CATransaction commit];Milkandwater
True. I was using CATransaction.begin in DispatchQueue.main.async. the moment I removed the CoreAnimation from DispatchQueue.main.async. The warning went off.Medication
T
0

This can show up in the logs if you use UIWindow.rootViewController to skip storyboards altogether.

To ditch the log message you can remove the storyboard, remove the key associating the Storyboard with your app in info.plist, set LaunchScreen.storyboard as the Main Interface in the target and use

window = UIApplication.shared.keyWindow!

inside AppDelegate to get the main window and assign your UIViewController on it.

Teammate answered 6/9, 2018 at 12:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.