question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

addPolyline of release 1.4.5 crashes with iOS 11

See original GitHub issue

I’m submitting a … [ ] question [x] any problem or bug report [ ] feature request

The plugin version: [x] 1.4.5 [ ] 2.0-beta3 (github) [ ] 2.0 (npm)

If you choose ‘problem or bug report’, please select OS: (check one with “x”) [ ] Android [*] iOS

cordova information: (run $> cordova plugin list)

com.googlemaps.ios 2.4.0 "Google Maps SDK for iOS"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 1.4.5 "cordova-googlemaps-plugin"
cordova-plugin-whitelist 1.3.2 "Whitelist"

Current behavior:

The iOS 11 application crashes when addPolyline(...) is called, it also crashes with following snippet.

The crash report is following

2017-09-24 15:45:50.273741+0300 MyApp[62221:953743] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Polyline initWithWebViewEngine:]: unrecognized selector sent to instance 0x600000135f40'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010defc1cb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x000000010d830f41 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010df7c914 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   CoreFoundation                      0x000000010de7f178 ___forwarding___ + 1432
	4   CoreFoundation                      0x000000010de7eb58 _CF_forwarding_prep_0 + 120
	5   MyApp                          0x00000001091128cc -[CDVViewController getCommandInstance:] + 348
	6   MyApp                          0x00000001090cd607 __19-[GoogleMaps exec:]_block_invoke + 1111
	7   libdispatch.dylib                   0x00000001107513f7 _dispatch_call_block_and_release + 12
	8   libdispatch.dylib                   0x000000011075243c _dispatch_client_callout + 8
	9   libdispatch.dylib                   0x0000000110757352 _dispatch_queue_override_invoke + 1458
	10  libdispatch.dylib                   0x000000011075e1f9 _dispatch_root_queue_drain + 772
	11  libdispatch.dylib                   0x000000011075de97 _dispatch_worker_thread3 + 132
	12  libsystem_pthread.dylib             0x0000000110c155a2 _pthread_wqthread + 1299
	13  libsystem_pthread.dylib             0x0000000110c1507d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Expected behavior:

Same application works perfectly with iOS 10

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
fogfishcommented, Oct 2, 2017

Right… No needs to patch CordovaLib/Public/CDVViewController.m. You can rename a feature at the plugin. I am going to test the following patch at HW. It works at emulator.

v1.4.5-iOS11.patch.zip

My branch is available here. https://github.com/fogfish/cordova-plugin-googlemaps/tree/v1.4.5-iOS11

1reaction
gitoplasmcommented, Oct 2, 2017

Polyline gets instanced by name, and there’s something else called Polyline in iOS 11 which is getting instanced by Cordova instead, so I got it to work by changing the name of the plugin’s Polyline class. We’re in a bind because 2.0 doesn’t support KML yet, but this gets it to work for now.

if you renamed the Polyline in Polyline.m and Polyline.h in the plugin to PolylineNewclass,

Plugins/Polyline.h line 12:

@interface PolylineNewclass : CDVPlugin <MyPluginProtocol>

Plugins/Polyline.m line 11:

@implementation PolylineNewclass

Looking at line 550 of CordovaLib/Public/CDVViewController.m you would add this code to have it instantiate Polyline to your new class name.

    if (!obj) {
        if([className isEqualToString:@"Polyline"]) { // added
            obj = [[NSClassFromString(@"PolylineNewclass")alloc] initWithWebViewEngine:_webViewEngine]; //added
            } //added
        else { //added
            obj = [[NSClassFromString(className)alloc] initWithWebViewEngine:_webViewEngine];
            } //added

This is from 1.3.9 and I’m assuming that the line numbers are similar in 1.4.5

Very helpful plugin even if you’re unable to fully support kml, so thx to the authors for all your hard work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS 11 home screen app crashes if … | Apple Developer Forums
After upgrading to iOS 11 we are finding that our home screen web app will crash if we try to launch it within...
Read more >
Untitled
Bug fix: import images crashed on older iOS versions - Bug fix: cycle offsets displayed ... Import multiple images as sequence (requires iOS...
Read more >
5+ Ways to Fix Apps Crashing on iPhone - YouTube
iPhone apps keep crashing is a common issue with iPhone users; if you're looking for a permanent solution, you're in the right place...
Read more >
Mobile SDK Changelog - LogRocket Docs
1.4.5 (2022-07-21). [iOS] Resolved a potential crash issue related to correctly freeing memory.
Read more >
Bug: ArcGIS Runtime SDK for iOS and .NET (Xamarin.iOS) 3D ...
The issue impacts recent iPhones and iPads with A14, A15, or M1 processors. This has been resolved with the release of ArcGIS Runtime...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found