WebView crashes on navigation popBackStack() with Jetpack Compose LazyColumn - android-webview

I have WebView inside the LazyColumn. It shows up fine. The thing is when I try to navigate back by calling navController.popBackStack(), I got fatal crash (Fatal signal 11 (SIGSEGV)).
I ran it on the emulator. It works fine when click the "Back" button in the emulator.
Also, it works fine when I replace LazyColumn with Column.
Any idea or thought?

I had the same issue and you can fix this in some ways that I've found:
destroying your WebViev webView.destroy() or making it invisible webView.visibility = View.INVISIBLE when your screen disappears.
adding alpha = 0.99F (any value but less than 1) to WebView. webView.alpha = 0.99F

When using WebView inside LazyColumn try using the remember function to retain the state across rebuilds. Alternatively, you can try a different layout component like VerticalScroller to wrap the WebView.
LazyColumn{
items(items){
// ...
remember {
WebView(/* ... */)
}
}
}

Related

Running the google places modal popup in flutter

Looking at the flutter code it seems like I should be able to run the google places modal dialog since it does a full screen thing and doesn't try and overlay on top of flutter.
However I am having an issue where the modal shows up and then disappears again immediately. I am not entirely sure how to solve this...
I am activating it with:
call.method == "openPlacesDialogModal" -> {
val code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activity)
if (GoogleApiAvailability.getInstance().showErrorDialogFragment(activity, code, REQUEST_GOOGLE_PLAY_SERVICES)) {
return
}
//val intent = Intent(activity, PlacesActivity::class.java)
//activity.startActivity(intent)
var intentBuilder = PlacePicker.IntentBuilder()
activity.startActivityForResult(intentBuilder.build(activity), PLACE_PICKER_REQUEST)
placeResult = result
return
}
In the logs I get:
I/FlutterActivityDelegate(18184): onResume setting current activity to this
I/flutter (18184): Opening picker
I/FlutterActivityDelegate(18184): onResume setting current activity to this
I think it is the onResume getting back to the ActivityDelegate that is the issue.
I put this on top of a completely different activity too, which kind of works. It shows the dialog for longer. I made sure I have all the right permissions, I have the fine location, internet permissions. Do I need to setup anything else?
Thanks,
David.
Error here was that I was not setting up the google api correctly and it was erroring immediately. Had to put in some checks to look for this error so I could respond correctly to the app that an error occurred.

Xcode 8: UI Testing, Neither element not any descendant has keyboard focus

I've recently started to use UI testing within Xcode. I was able to record the test and play it back and it worked perfectly fine. I recently changed the accessibility labels for textFields to make the test look cleaner by giving it a better name.
However, now when I record the UI test and play it back again to test it, I get an error "Neither element not any descendant has keyboard focus.". I've attempted to uncheck hardware keyboard as mentioned in other posts, but that doesn't work for me.
//test login with username and empty password
let app = XCUIApplication()
let elementsQuery = app.scrollViews.otherElements
let emailtextfieldElement = elementsQuery.otherElements["emailTextField"]
let passwordtextfieldElement = elementsQuery.otherElements["passwordTextField"]
emailtextfieldElement.tap()
passwordtextfieldElement.tap()
emailtextfieldElement.tap()
app.typeText("wayne#test.com")
passwordtextfieldElement.tap()
app.buttons["Login - signInButton"].tap()
Anybody know the fix for this?
Use typeText on emailtextfieldElement instead of app.
let emailtextfieldElement = elementsQuery.otherElements["emailTextField"]
emailtextfieldElement.tap()
emailtextfieldElement.typeText("wayne#test.com")

RE:Create a button which when pressed it replaces an existing object on the screen to another object in Smartface App Studio?

After seeing #catherinelagoon's post I also having difficulty in quite understand how to replace an object using a button so is it possible to create a button which when pressed it replaces an existing object on the screen to another object in Smartface App Studio?
I tried using the answer provided in the post however I couldn't understand it much due to I'm a beginner in using Smartface App Studio and coding itself.
Thankyou and sorry for any inconvienience
After you create an image you should add it to a Page so it can show on that page. So here is a simple code for creating and showing an image on the page.
var image = new SMF.UI.Image({
visible: false
});
Pages.Page1.add(image);
function Page1_TextButton1_OnPressed(e) {
image.visible = true;
}

XPC connection interrupted in Xcode 7 for iOS 9

I recently updated to Xcode 7 and upgraded my iPhone to iOS 9. I have developed and released an iOS app that had worked perfectly fine on the latest version of iOS 8 and Xcode 6.
Upon trying to go through the process of updated the app for iOS 9 support, I am getting the most ridiculously strange error that has left me baffled.
I have done all the syntax corrections automatically through Xcode, and now my app builds properly. It even runs fine at first.
I have a button that segues to a view controller with a WebView. This view controller loads a link that will display either an image, website, or video from youtube. The content is loaded perfectly fine as always. However, the program will crash and reboot the simulator (and my iPhone) and send me to the lock screen when I click the Back button (I am on a navigation stack).
In Xcode, I get the following messages:
XPC Connection Interrupted.
Terminating since there is no system app.
I have Flurry analytics integrated in my app by the way, not sure if thats an issue.
How can I fix this issue? My searches for XPC connections do not seem to return problems similar to mine. I do not even have a clue what an XPC connection is, so why is this in my app anyway?
EDIT: I have found a workaround for the issue. I cannot really say it is a fix.
The crashing was occurring during the use of the method self.navigationController?.popViewControllerAnimated, when set to true. I happened to set this to false, and the crashing stops (now the transition looks awful).
I do not know why this works, and just adds to my confusion.
The problem lied in the storyboard for me as well. I created a new project and laid out the views and everything seemed to be working fine. I found these couple lines in the storyboard source (right click on storyboard and select view as -> source code) which weren't common between the working version and the broken version:
<keyCommands>
<keyCommand/>
</keyCommands>
I have no idea what those lines are supposed to do, or how they crept into my storyboard file, but they were what was crashing the app so hard that the phone had to restart. I removed those lines from my main project and everything worked again.
This error can be caused by executing a loop repeatedly. In my case it was a 'for' loop in which I reset the counting variable. As soon as I added an NSLog in the loop it was obvious.
I just faced the same problem. I don't know if that will help you, but I also think it's coming from the Storyboard:
In my case, the problem is coming from a UITextView. Whenever I try to change the default text inside it, I have this error. If I let the default text or leave it empty, the app works fine. Making an IBOutlet and changing the text programmatically works as well.
I tried with other UI elements, but only the UITextView seems to have this issue.
I have struggled with exact same error. Through a process of elimination I established that it had nothing to do with the any class but had to do with the storyboard. Luckily I keep regular backup copies and I tried to compare storyboards to establish what I had done - but could find nothing obvious.
The backup copy worked fine and I was able to copy my controller classes (from the faulty copy with the changes) into the backup copy and they worked fine.
I think there is a bug possibly in storyboards.
I have same error message when I place a subview in -layoutSubviews method:
-(void)layoutSubviews
{
[super layoutSubviews];
[self populateByImageViews];
}
It causes infinite cycle of layout process and crashes app. Don't place subviews in this place!
Deleting UITextView from the one of the view in Storybord removes the error in my case.
In valueChanged: method of a UIControl, I had the same problem
so I made the code inside valueChanged: to run in main thread and it solved the problem.
#IBAction func valueChanged(sender: AnyObject) {
dispatch_async(dispatch_get_main_queue(), {
//code
}
}
For me was some missing constraints with a UISearchBar, but the error was only in the simulator.
I only add some constraints and works better
For me it was xcode live issues caused by IB_DESIGNABLE
If you have any IB_DESIGNABLE in source files, the system's live tracker will check for issues in StoryBoard too. It may leads to unnecessary building.
To disable it-
Open Storyboard file. Editor -> Automatically Refresh Views (Uncheck)
If you needs to Disable Live issue tracking
XCode -> Preferences -> General -> Issues -> Uncheck Live Issues
Reference
My issue probably originated with some storyboard issue, but I cleaned the project, restarted Xcode AND restarted the simulator app and that fixed it.
When using QLPreviewController, I am confronted with this problem. Error messages as follows,
XPC connection interrupted
_BSMachError: (os/kern) invalid capability (20)
_BSMachError: (os/kern) invalid name (15)
Since XPC means OS X interprocess communication, so I think this can solve the problem, especial when updating the UI
dispatch_async(dispatch_get_main_queue(), ^{
// do what you want to do.
});
For Swift 4+, user
DispatchQueue.main.async {
//Your Code
}

Sencha Touch 2 textfield's focus issue in iOS 7

I'm having an issue with textfields in Sencha Touch 2, this is only occurring in iOS 7 and working fine in iOS 6 and Android.
The issue is when you tap a field the keypad opens but the cursor disappears, it should be focus on selected textfield but it does not. You have to tap the textfield again to focus.
I have checked this issue on iOS 6 and android (on devices as well as on simulators), working fine but not on iOS 7 only.
Is anybody having this issue...?
Is this a bug in sencha or should i missing something, please advice.
Thank you..
I have found this to be directly related to two things:
centered: true
pack: 'center'
When I removed those lines, my app started playing nice. The challenge is to find an alternative way to center your panels.
I spent days figuring this out. Actually there is a problem with Sencha understanding the ViewPort height. In your index.html add a script block with the following code
if (window.device && parseFloat(window.device.version) == 7.0) {
document.body.style.paddingTop = "20px";
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight() - 20);
}
This does two things for you
It Provides enough space on Top to display the activity bar
It sets the Viewport height to be that of screen height, irrespective of the keyboard being present or not.
Also, If your app works in Portrait and Landscape mode, you will need to add these lines in your Viewport.js (or Main.js)
initialize: function(){
Ext.Viewport.on('orientationchange', 'handleOrientationChange', this, {buffer: 0 });
},
handleOrientationChange: function(){
try{
if (parseFloat(window.device.version) == 7.0) {
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight() - 20);
}else{
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight());
}
}catch(e){
// do nothing
}
},
And Yes, Make sure they Keyboard Bounce is TRUE in true (if you are using cordova). This will make sure your field does not get hidden.
Hope this works for you.
add height="device-height" in viewport meta tag, fixes the issue.
ios7 issues with webview focus when using keyboard html