Bug 11835 - MonoTouchException NSInvalidArgumentException invalidatePageViewController
Summary: MonoTouchException NSInvalidArgumentException invalidatePageViewController
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 7.2.0 (iOS 7.1)
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2013-04-17 16:52 UTC by Fredrik Haglund
Modified: 2015-04-16 10:40 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Fredrik Haglund 2013-04-17 16:52:13 UTC
I showed this exception for Rolf Bjarne at Evolve 2013 Conferance and he asked me to file a bug.

Using the Google Maps component in a UIPageViewController. It is opened with a button using a Segue Push from the root view with UINavigationController. When you click the back button you get an exception:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[GMSVectorMapViewBridge v]: unrecognized selector sent to instance 0xd329d80
  at at (wrapper managed-to-native) MonoTouch.Foundation.NSObject:monotouch_release_managed_ref (intptr)
  at MonoTouch.Foundation.NSObject.ReleaseManagedRef () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:98
  at MonoTouch.Foundation.NSObject+NSObject_Disposer.Drain (MonoTouch.Foundation.NSObject ctx) [0x00062] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSObject2.cs:545
  at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
  at MiniHacks.Application.Main (System.String[] args) [0x00000] in /Users/fredrik/Projects/MiniHacks/MiniHacks/Main.cs:17

This code causes the failure:

		public override void LoadView ()
		{
			base.LoadView ();

			var camera = CameraPosition.FromCamera (latitude: 59.338, 
			                                        longitude: 18.066,
			                                        zoom: 8);
			mapView = MapView.FromCamera (View.Bounds, camera);
			mapView.MapType = MapViewType.Normal;
			mapView.MyLocationEnabled = false;

			View = mapView;
		}

Replacing "View = mapView" with "View.Add (mapView);" and the problem is gone.
Comment 1 Sebastien Pouliot 2013-04-22 11:18:43 UTC
I've seen this last week (evolve) and got a similar error this morning.

2013-04-22 10:11:26.175 GMapsiOS[11080:23203] Google Maps SDK for iOS version: 1.1.2.2533
2013-04-22 10:11:26.177 GMapsiOS[11080:23203] New version of Google Maps SDK for iOS available: 1.2.0.2863
2013-04-22 10:11:26.254 GMapsiOS[11080:1d603] -[__NSCFDictionary objectForKeyedSubscript:]: unrecognized selector sent to instance 0x1b17ca20


It seems to be related to XS starting an older version of the simulator (e.g. 5.1) when the (native) library requires something newer (e.g. 6.0). I filled a bug for this:
https://bugzilla.xamarin.com/show_bug.cgi?id=11886


Can you still duplicate the issue ? if so can you check if XS and the Application Output shows the same simulator version ? thanks!
Comment 2 Rolf Bjarne Kvinge [MSFT] 2013-04-25 17:57:24 UTC
This is the google maps doing stuff in the dealloc method (which ends up trying to call managed code), after the native object has been disconnected from the managed object.
Comment 4 PJ 2013-11-19 16:45:04 UTC
This bug was targeted for a past milestone, moving to the next non-hotfix active milestone.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2015-04-16 10:40:52 UTC
This was fixed a while ago, now we only disconnect from the native object after dealloc has completed.