I am experiencing strange StageWebView behavior. I am opening a StageWebView in a view that is pushed in navigator, I have a close button in the view that Pops up the view from navigator..
The first strange thing the StageWebView doesn't go with view popped up, it is quite obvious as the StageWebView is getting added in the current stage.
Then I tried to set the webView.stage=null, that actually removes the webView, but it gives error as one parameter required.
Then I tried with webView.dispose() with try catch surroundings bingo, it worked. BUT now when again I push the view the StageWebView doesn't appear..
Anyone with any idea, can help me out..
Thanks..
Dispose() literally disposes the webview meaning you need to recreate the object again in order to use it again.
var webViewObject = new "Object" (can't remember the class off top but you get the idea)
You're on the right track though
Related
I am making the auth portion of the app (login,register,forgot password pages). since i have a function that handles the errors which i call for all the different transactions (log in, log out, register user, etc) and if it catches that error then it sets a custom message to a variable in my viewmodel(environmentObject) which then is observed by a view on the screen that draws it to the screen accordingly.
Problem is that if i get an error in login page and say navigate to forgot password then the error is still saved on that viewmodel variable and since it is also observed from forgot password page then it gets displayed on this page even though it has nothing to do with it. (this happens between all screens not just those two). The fix i have in mind is resetting the variable every time i navigate into a new page, however i have no clue how to do this swift. Using swiftUI
I have tried using init block and reset the variable there however init runs before my environmentObject is initialized therefore I cannot set a member variable there.
I ended up using .onAppear(perform:{ //reset variable here}) on the highest view of each screen and it worked like a charm, alternatively I could have use .onDisappear() on the oldScreen to produce a similar effect
I am running iOS 14.0.1, Xcode 12.0.1 targeting iOS14.
I have data in CoreData that I pull out and display in a SwiftUI List/ForEach. It was working fine on iOS13, but when I went to iOS14 is started getting intermittent crashes. After I add a new object to core data and then go back to the List/ForEach view it repaints the list but sometimes it over counts the number of elements and crashes with a Bug_Detected_In_Client_Of_UITableView_Invalid_Number_Of_Rows_In_Section. Since the array of entities from Core Data is observable and mapped directly to the List/ForEach I have no control over the count at all. It never crashes on the iOS 14 simulator, only on a real iPhone. It does not crash ever time I add a new entry, only sometimes seemly at random. It never crashed on iOS13 either on the simulator or a real iPhone.
This is the code to display the list;
List {
ForEach(self.locations, id: \.self) { location in
LocationView(currentLocation: location)
}
.onDelete(perform: self.deleteSelectedRow)
}
Is anyone else having this issue? It appears to be some internal bug to iOS14 ForEach processing with a CoreData created observable object, but if that were true I would think many people would be having the same issue, but I do not see any comments about this some sort of problem. Anyone have any ideas?
Thanks in advance for any an all ideas and help anyone can give!
the crash is due to the underlying TableView code inside SwiftUI framework.
Refer to this link for more info: https://developer.apple.com/forums/thread/129956?page=1#650267022
Having problems popping a UIMenuController when using multiple (side by side) windows.
So I handle a tap in a view then I set the firstResponder to that view, then I present a UIMenuController in that view and the canPerformAction: is called on that view - all good!
I then attempt the same in the adjacent window (same code obviously) and the canPerformAction: is still sent to the previous view (in the other window.) Indeed, pressing the menu also results in the handler being called on the other view.
Both views return YES from canBecomeFirstRepsonder:
Anyone got any ideas?
Thanks
Turns out you need to call [view.window makeKeyWindow] prior to calling [view becomeFirstResponder] prior to presenting the UIMenuController.
Makes sense I guess...
In swift3 I have done multiple segue's but in my latest one when I do one:
self.performSegue(withIdentifier: "registrationSettions", sender: self)
where registrationSettings is a "show" segue to my RegistrationViewController class.
In xcode 8 it just steps over the performSegue call without doing a transition into the view controller code (I have a break point in it in the viewDidLoad (first line) and it isn't reached). And no errors are generated to the system console.
I have over 15 other classes where doing segue's work just fine. So my question is under what cases can performSegue be used where the view controller isn't entered and no errors are generated in the system console? I know that the segue specified is correct because I have tried spelling it incorrectly and I get an error in the system console. I have also used a segue link to a view controller that works and the transition works fine.
I have deleted and re-added the view controller and deleted and re-added the structure for it in the Storybook and it still acts the same.
I can add the code but I don't know how I would show the Storybook structure. But it still comes back to why the performSegue call is stepped through in Xcode without transitioning into the view controller code and no errors are generated to the system window.
Has anyone seen this behavior? I have done several days of surfing and haven't found anyone who gets this behavior. Usually it results in errors in the system console.
All,
I have searched around for an answer to this but have yet to find a good explanation and solution. Hopefully, you can help.
I have a route that renders an Ember.ContainerView (as opposed to a standard Ember.View). When I transition away from this route and then back to it (either via the back button, a link-helper or just changing the url) I get the following error in the console:
Uncaught Error: Assertion Failed: calling set on destroyed object
I understand that a high level reason for this is that when we transition away from the route with the ContainerView, it's childViews are marked as destroyed. When we transition back to the route, the problem has something to do with Ember trying to set the childViews back to the destroyed instances.
I'm not exactly clear but that is the vague understanding I currently have.
So, my questions are as follows:
Can you please correct my understanding of this problem if it is not correct?
Can you please tell me how to fix this error?
For your convenience, I have created a JSBin example for your viewing pleasure. To replicate the error, open your JS console, click on the Go to Route two link, then click on the Go to index link. Now check your logs.
Thanks in advance for any assistance you can provide.
Here is the fix: http://jsbin.com/jumoy/1/edit?html,css,js,output
I have encountered this problem before. I can't say I truly understand it at a very detailed level, but here is the general problem. When you are defining your container view, it is actually creating that subview when you define it, not when you create an instance of the view. This means that your childview 'initial' is only being created one time, and thats when the file is initialled parsed and the ContainerView is defined. When ember cleans this childview up, it is not gone for ever and 'initial' will always be equal to a cleaned up view.
By setting 'initial' as a property, it will be created every time a new instance of your container view is rendered, and therefore a new childview will be created and accessible.
So moral of the story, try not to create objects in definitions of controllers/views. Instead create properties that return the creation of that object.
Hope this helps and makes sense.
UPDATE::
I have edited the jsbin to show you on a deeper level what is happening and why it isn't working. To see the effect uncomment the second ContainerView and comment out the first, you will notice in the console logs that the second time you go to the twoRoute, it has marked that initial property as state: destroying for the view.
http://jsbin.com/jumoy/2/edit?html,js,output
if you are using Ember.Instrumentation namespace for publishing your events and Ember.subscribe to listen to them in your code, when you publish events, it stack all the subscribers and call them even when they are destroyed.
so basically, when for example your route is destroyed which is running subscribe statements it will fail and give above error.
Here is a solution to this problem: Use Ember.Instrumentation.reset() to remove previous subscribers which are destroyed. This solution helped me in acceptance tests where app was destroyed after tests are finished.
I wrote Ember.Instrumentation.reset() in startApp function of module-for-acceptance.js and it worked.
Hope that helps.