MonoTouch.Dialog Elements can be null when search bar used too quick - iphone

I have a DialogViewController with many elements and a search bar. When a user taps between the search bar and the cancel button fast, the Elements node of the Section in the following MonoTouch.Dialog.Elements.cs code is sometimes null so it throws an error and the app is torn down by the OS. Is there a work around?
From Elements.cs, latest Git version. Only happens on a real device.

To turn this into an answer - I think this is a bug.
I have filed it at:
https://github.com/migueldeicaza/MonoTouch.Dialog/issues/94
And produced a sample which reproduces the bug at:
https://github.com/Macropus/Bug-Reports/blob/master/BugReport94/BugReport94/AppDelegate.cs
I think it may be a threading synchronisation issue where the thread is trying to access the Root.Elements but they have been removed by the Cancel button.

Related

Flutter InappWebView canGoBack - no implementation found for method

I am developing navigation to the previous pages for my flutter browser app, and to do this I am using goBack and goForward methods of InAppWebViewController.
To check whether I can go back (to change color of navigation buttons) I also call canGoBack method. As it returns Future, I am using FutureBuilder to display these icons.
I propagate canGoBack() or canGoForward() to the future field of FutureBuilder. And then a lot of strange thigs happen: sometimes when I switch between different tabs (which work similar to tabs in https://github.com/pichillilorenzo/flutter_browser_app) I receive:
MissingluginException: No implementation for method canGoForward on channel com.pichillilorenzo/flutter_inappwebview_n, where n is some number
Bug usually occur when I pop back to the widget with buttons and InAppWebView from tabs page.
I've searched all related github issues and haven't found anything related, tested on android(emulator + real device), iOS (simulator + real device) - and I cannot even see the pattern of how to reproduce this bug.
So, I have several questions:
What may be the reasons for this to happen? At first glance, it happens at random moments
What 'channel' exactly means here? I would be glad to read more about that
May it be caused because I use FutureBuilder?

Property additionalActions of NSUserNotification seems not working?

To understand NSUserNotification better, I wrote a little test app playing with this class.
So far so good, except that no matter how hard I tried to feed the additionalActions property with array of NSUserNotificationAction objects, it never showed any difference but only one action button and a close one.
My expectation for this property is that the notification would show a pull-down menu containing the additional buttons I offer as it does in the Mac App Store update notifications.
Am I missing something? Or are you having the same problem, since it is a bug awaiting Apple to tackle?
Can you please try to click and hold down the action button in your notification? Does it show a drop-down menu of additionalActions?
Update
As it turns out, you can show the little chevron next to the action button by setting a true value for the private _alwaysShowAlternateActionMenu key on the notification. In Swift 3, it would look like this:
notification.setValue(true, forKey: "_alwaysShowAlternateActionMenu")
However, as I mentioned this is a private API and I strongly advise against using it if you want to distribute your App through the Mac App Store.
It is probably a bug. Setting up additionalActions will create the list, but not the little arrow icon. Holding down on actionButton will show the menu with the number of actions you set.
Besides setting additionalActions will cause several other problems. I will save this for another question.
Refer to another question.
show NSUserNotification additionalActions on click
P.S. I am using El Capitan APIs

Custom PickerView froze up (With sample project)

Background: I have been wanting a PickerView that is exactly matches that of Safari. I looked through many Gits and found none that work quite as exactly. I decided to build my own. It is complete now, but there is a bug that would not go away.
Problem: If you run the sample project you will be greeted with 2 text fields.
Tap on one of the textfields - it brings up the BTPickerView. Everything works just as you would expect.
Choose the fourth choice, then press done.
Tap on the same textfield. This time, the debug log will show you that you have executed an infinite loop, which freezes the app.
Question: What did I do to cause it? And how do I fix it?
I have tried everything to boil it down. It comes down to this and I could not go any further. Please advise.
Edit: Here is the sample code you can download in case anyone missed the blue link above.
The issue seems to be with the constraints in BTPickerLabel. If you temporarily disable the constraints from BTPickerLabel, code works fine. Enforcing constraint might trigger the reloading of entire picker view infinitely. I hope it should help you to fix the problem.

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

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.

How do you get the Eclipse menubar to update on demand?

I'm working on a plugin aiming to hide a swathe of menu contributions, then slowly reintroduce them to the UI according to how confident/experienced the user is, with help and introductory information given to the user at each step. So far I can happily hide menu contributions using activities. Getting them back has proved to be slightly more difficult, however.
I have menu contributions being hidden and shown via activities, but the problem I've run in to is that the menu isn't instantly updating to reflect the activites. When my provided variable is changed, the activities are being started/stopped appropriately, but the menu doesn't immediately change. That is, until you change view or perspective- actions which cause the menu to be refreshed.
I've tried calling refresh() on the MenuManager, as per this question, to no avail.
Obviously my expression is being evaluated immediately, but how can I get the menu itself to update/refresh immediately?
Thanks!
It turns out there were issues with fireSourceChanged().
Calling: fireSourceChanged(int sourcePriority, Map sourceValuesByName) doesn't work for me.
But calling fireSourceChanged(int sourcePriority, String sourceName, Object sourceValue) does work.
I really don't know why that is - could be an Eclipse bug??