How to debug infinite loop "crash" in Xcode for iOS involving CALayer and view layout during search? - iphone

My app is hanging during search in a table view.
For what it's worth, the view hierarchy is very complex, there are popovers involved as well as filters and search bars etc. I am reviewing all those possibilities.
But the non-crash - it's an infinite loop - occurs when the search results table is being displayed / updated, after a call to reloadData.
Here is what I get when I stop the program and look at the main thread:
You can see - it involves UIView, CALayer, CATransaction. I have no clue how to get back to my controller classes to find the offending code.
Any hints, suggestions, wild guesses welcome!
EDIT Here is more - some more classes appearing when I interrupt at some other random point.

This is an old question, but in case other folks arrive here: it's possible you're facing a layout feedback loop. I wrote an article about how to debug these (link: Debugging Auto Layout feedback loops) but here's a summary:
If you modify your layouts during layout, or if you have ambiguous layout, you might find yourself stuck in a loop.
Apple discussed a special debugging technique at WWDC 2016 – skip to about 15 minutes before the end, and they introduce the layout feedback loop debugger.
To try it yourself, add -UIViewLayoutFeedbackLoopDebuggingThreshold 100 to the list of launch arguments for your app, then run it again.
When the error happens next time, you should get (a lot of) debugging information that helps point you in the right direction.

Related

Plotly Dash - Callback triggers sometimes & the same callback doesnt trigger sometime

I am facing issue with callbacks. I have 3 drop downs, one scattermap , one table and one slider on the screen and they all need to work in tandem and i have 5 call backs. When i execute the application all my callbacks associated with these controls execute in random order. After that when i click on scattermap it may or may not work. Say we assume it worked. Then i can navigate all around without any hassle. Then if i execute the application then click on the scattermap then as i mentioned it may or may not work. Say suppose it didn't work this time. If so is the case it will not work at all no matter what i do and simulaneously one specific dropdown also becomes dysfunctional. However if click any of the other two drop downs then evrything will start functioning as normal.
I have digged really deep into this and figured out that this has nothing to do with my code. The underlying issue is that when the click doesn't work the reason the reason behind that is the callback isn't getting triggered. I found out this by applying some debugging techniques and i am 100% sure the callback is not firing. Can anyone help me resolve/understand this please.

Xcode Instruments : Unable to identify the memory leak issue

I'm facing some serious memory-related problems in maintenance project and unable to identify the cause for the issue I'm facing. Please find the attached below image for reference.
Help would be much appreciated.
The Cycles and Roots screenshot you showed doesn't provide any information on what's causing the leak. If you want to find the leaks in your code, switch to the call tree view using the jump bar. Click the Call Tree button at the bottom of the window and select Invert Call Tree and Hide System Libraries checkboxes to make it easier to find your code in the call tree view.

Transitions an arrow-, bullet-, thumbnail- and key-navigation

It has already been suggested several times that the a.m. navigations also use the transitions used in "autoplay".
I would like to support that, because the current handling of just moving the slides sort of breaks the "look and feel" of the slider behaviour.
"Swiping" and "dragging" could stay as is.
Maybe configurable with an option???
Have tried to solve that myself in the code, but failed miserably so far :-( :-).

ReactiveUI - Confused about Routing

I'm in the process of comparing MvvmCross with ReactiveUI for a major pharma project on Win Store, WP8, iOS, Droid. We've already selected Xamarin.
I'm totally new to ReactiveUI. I really like what I see in principle, and I think Paul is a genius. However the details are becoming a real bear. I've spend several days tracking down documentation (the manual is from 2011 and seems almost entirely outdated - it doesn't even contain the word "Router") and sample code.
I'm looking at the sample from ReactiveUI.Samples
Also the project MobileSample-RT from the ReactiveUI solution.
I based my little hello world on the ReactiveUI.Samples "Routing" example. Frankly this isn't much of an example as all it does is navigate from AppBootstrapper to the one and only view. I'm trying to do something similar to the "three page" example from MobileSample-RT. The problem is, if I try something like this in my project:
HostScreen.Router.Navigate.Execute(RxApp.DependencyResolver.GetService(typeof(LoginViewModel)));
It crashes (pdb symbols not loaded in ReactiveUI.dll)
If I try this:
HostScreen.Router.NavigateCommandFor<LoginViewModel>().Execute(HostScreen);
Same result - hard crash. That really threw me as it seems like something that should "just work".
I can call this:
HostScreen.Router.Navigate.Execute(new LoginViewModel(HostScreen));
And it does go to my view, as expected. I also wired up a back button in the main screen:
this.OneWayBind(AppBootstrapper, x => x.Router.NavigateBack, x => x.BackButton.Command);
And that indeed moves back from the view to which I'd just navigated.
So now I want to move forward again. I click on the button that does this (again):
HostScreen.Router.Navigate.Execute(new LoginViewModel(HostScreen));
And I go back to that view. However this time it takes 2 clicks on the back button to get actually move back. If I then move forward again, it takes 3 clicks the next time. The NavigationStack is filling up with new instances of LoginViewModel.
So, what IS the correct way to do routing/navigation? Why are those commands crashing? Rather than calling "new" each time in the Navigate.Execute, how do I navigate to a viewmodel that is already in the navigation stack (or should it be there in the first place?).
Many thanks for any clarity you can provide.
If you're building for iOS and Android, you simply don't want to use Routing - the notion of routing conflicts too much with what the platforms want you to do (even on WP8 it's a stretch but I was able to hacky make it work). You should stick with View-first location.
However, if you're using Xamarin Forms, ReactiveUI works great with VM-based routing (since Xamarin managed to do all the hacks to make it possible!). Check out https://github.com/paulcbetts/xamarinevolve2014 for a demo of it
I know the docs suck and I'm working on new ones:
https://github.com/reactiveui/ReactiveUI/pull/391 - Pull Request / Progress
https://github.com/reactiveui/ReactiveUI/tree/docs/docs/basics - Browsable version

Is it possible to turn a View-Based App into a navigation-Based App?

I am close to finishing my first application (a UITableView style one) on the iphone but have realised it will look much better, and stand a far better chance of getting through the approval process, if it is presented as a navigation-based app rather than a view-based one - in hindsight my initial choice is not really suitable...
Is it possible for me to somehow change easily the application into a new type, or would i be better starting again from scratch with all the hassle that would entail...
thanks for any advice on how it may be done,
karl
It wouldn't be particularly difficult to shift the means of interaction to a navigation controller from a simple view controller (it also isn't difficult to go the reverse direction). Although, there isn't anything as simple as a tutorial on how to do it or menu item you can select. You could look at the plumbing generated by Apple's template for a navigation based application and add the necessary glue to your app delegate. Once that is in place you could simply push your view based applications view controller onto the navigation stack. If you have more specific questions or are stuck somewhere in particular we can help to get you un-stuck if you provide details about where you are running into issues.
As an aside, I doubt your application will be rejected solely for being view based vs. navigation based.
Hmmmmm, for soem reason t wont let me add anything to comment on your post!
Anyway, i guess this is as good as anything here...
Ive been messing for the last hour or so and have managed to integrate my old code/data etc into a new navigation one without too many problems, in fact it looks nicer with a title bar at the top!
(I do like to try and work stuff out for myself so its a good learning curve!)
I am still struggling in that although the new view opens up i am
struggling to use a string from the first view (I have a UITableview table in there, i select a row and get a correct value from it which i currently check via an alert message) in the second view.
for some reason i do not get a title bar and 'back' button in the 2nd view so i guess it is not being put on the stack correctly (I have put a quick 'return' button in the view for testing purposes so i can navigate backwards and forwards).
Still, Im about 100% further on than i was earlier!
cheers for the reply,
Karl