Flutter GMSMapView updateWithCamera crash EXC_BAD_ACCESS KERN_PROTECTION_FAILURE - flutter

We're getting sporadic crashes in Google Maps running in our Flutter app on iOS. I have attached a screenshot of the stacktrace. The offending call is to [GMSMapView updateWithCamera].
The setup we have is basically:
BlocProvider<MapScreenBloc> → GoogleMapsWidget → GoogleMaps (the last one being the actual Google Maps widget from the google_maps_flutter plugin)
When creating the GoogleMaps widget we pass it the bloc's onMapCreated function for the constructor parameter so that it stores the GoogleMapController. My guess is that at some point we're calling _mapController.animateCamera() but the controller has been destroyed, but I have no idea how to debug this.
Has anybody else experienced this? Any suggestions on how to debug/fix it?

It turns out that there was a bug in the iOS/Flutter implementation for Google Maps. I've created a PR for them here:
https://github.com/flutter/plugins/pull/3426
It turns out that they were repeatedly adding addObserver:, and when that keypath was finally updated the observer was called so many times that the OS forced the app to shut down because it thought that the app had entered an infinite loop.

Related

WidgetKit getCurrentConfigurations returns wrong list of widget-configurations

I've added Widget Extension with Configuration Intent.
For the logging purposes, I've tried to log number of widgets user of the app has
WidgetCenter.shared.getCurrentConfigurations { results in
guard let widgets = try? results.get() else { return }
..<log widgets.count>...
}
To my surprise, instead of the active [WidgetInfo]'s I've got a whole list of all the configuration intents ever been used in all the widgets instead of the actual ones.
I.e. I have 2 widgets on the screen, while WidgetCenter claims I have 9 current configurations. Any better ideas how to count widgets?
iOS 14 Beta 8 (both iPhone & Simulator) & Xcode 12 Beta 6
Apparently iOS caches the configuration of all widgets ever created for an app, and recreates the configurations cache on startup of iOS.
So if you really want function getCurrentConfigurations to return the current configurations, restart your device first.
It seems to be an Beta-issue, that has been resolved with GA-release. Need to observe more, but with today's Xcode build I'm seeing relevant numbers.
We were also trying to do something similar and were experiencing a similar issue. I think the issue is that the device is holding on to every widget configuration ever installed (which is odd and IMO not helpful). Once I erased all contents and settings the widget info reset back to 0.
Perhaps just a restart would clear that info out?

Image zooming issue on Ionic

I am trying to implement image zooming for image in Ionic app.
It has been implemented here
and works flawlessly on the original project created with Ionic V 1.0.0 but doesn't seem to work all that good in Ionic V 1.3.0.
On V 1.1.0 this
($ionicScrollDelegate.$getByHandle('scrollHandle' +
slide).getScrollPosition())
logs a json like this
{"left":0,"top":0,"zoom":1}
But in V 1.3.0 it logs it as
undefined
Also on chrome it shows warning like this:
Delegate for handle "scrollHandle0" could not find a corresponding
element with delegate-handle="scrollHandle0"! getScrollPosition() was
not called! Possible cause: If you are calling getScrollPosition()
immediately, and your element with delegate-handle="scrollHandle0" is
a child of your controller, then your element may not be compiled yet.
Put a $timeout around your call to getScrollPosition() and try again.
This is still working on devices (tested both on iOS and Android) but not smooth at all. It is very laggy.
Any thoughts or workarounds?
So the issue had nothing to do with Ionic version which I realised after more debugging. It was due to
delegate-handle="scrollHandle{{$index}}"
In my usecase I was not using ng-repeat so was using
delegate-handle="scrollHandle"
But this was not working and causing the above mentioned issues. So fix was to add 0 as index with it. In my case this solved it.
delegate-handle="scrollHandle0"
In other cases use case may be different so but if using ng-repeat this would work
delegate-handle="scrollHandle{{$index}}"
and if not this should do the trick
delegate-handle="scrollHandle0"

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
}

mobile web app - keyboard not appearing

I have a mobile web application, working well on simulator 5.1/6.0, xcode 4.5 for iphone.
But when I test on a real device (3gs, ios 5.1), I get a strange behavior: anywhere I place an input field html element, where I need the user to fill in something, I tap the field, it gains focus (I see the cursor), but the touch-keyboard does not come up and I can't type anything. If I try it on the sim, all is fine, the kb comes up.
I am not sure how to diagnose this... tried googling for some answers, haven't found any :(
any ideas?
thanks...
ok found the issue, seems like the app was not created using the latest Xcode template (it is a legacy app), so I removed the MainWindowxxx.xibs which I don't need, and used the code from a new XCode app template to initialize the app by programmatically creating the main view controller, and setting it as the window's rootViewController. And, of course, call [self.window makeKeyAndVisible]

Not able to enter a string in the TextField of UI-(iphone)

I brought a new MAC-MINI before this i was using MAC BOOk Pro..
i am facing some problem with xcode, the problem is when i run the Application where ever there is a TextField in the UI when i click to enter its not taking input,it takes hardly 1 or 2 strings and throws thread....
when i try to enter its throwing Thread in main() function telling EXC_BAD_ACCESS...
NOTE:The apps which were working before in Mac book Pro's xcode i mean apps which contains TEXTFIELD in the UI is also not taking input in the present xcode of MAC MINI.
if i tried without writing any code just placing a TextField in the UI and running it ,even then i am not able to enter anything in the UI its just throw Thread in main() function EXC_BAD_ACCESS..
I am not able to solve this issue may i know why its happening like this?
ITS NOT TAKING ANY INPUT IN TEXTFIELD OF PREVIOUS WORKING APPS AS WELL..
Is the problem with Xcode?
Plz Suggest me to solve this issue..
Thank u
Are you setting an object as the textField's delegate?
When you type in the text field, it tries to call its delegate (if it's not nil) to notify about a change in the text. If for whatever reason the delegate is dealloc'ed, you get this type of error, as the textField is trying to reference a deallocated object.