locked
Method not found: 'CoreLocation.CLLocationManager.set_Delegate'. Using xamarin mobile RRS feed

  • Question

  • User78609 posted

    Method not found: 'CoreLocation.CLLocationManager.set_Delegate'.

    I have been hitting the above error on two apps that I have upgraded to 64bit support. I have filed a bug at bugzilla for Xamarin.Mobile and I am getting the same error using the example below, anyone have any ideas ?

    var locator = new Geolocator { DesiredAccuracy = 50 }; locator.GetPositionAsync (timeout: 10000).ContinueWith (t => { Console.WriteLine ("Position Status: {0}", t.Result.Timestamp); Console.WriteLine ("Position Latitude: {0}", t.Result.Latitude); Console.WriteLine ("Position Longitude: {0}", t.Result.Longitude); }, TaskScheduler.FromCurrentSynchronizationContext());

    Tuesday, January 13, 2015 2:39 PM

All replies

  • User26481 posted

    Sam, I have the exact same problem, and it is not directly related to Xamarin.Mobile. Indeed, even if you write the code "by hand" using CLLocationManager, it fails. My guess is the bug is in the Unified API, not in Xamarin.Mobile.

    Tuesday, January 13, 2015 3:11 PM
  • User78609 posted

    Thanks Sebastien, at least its not just me, have you informed anyone at xamarin ?

    Tuesday, January 13, 2015 3:16 PM
  • User26481 posted

    Well, i just added to your bugzilla post, so that they see multiple users are affected.

    Tuesday, January 13, 2015 3:18 PM
  • User26481 posted

    Is anyone at Xamarin looking into this? Does anyone have a way around the set_delegate missing binding?

    Perhaps some way to create the binding by hand?

    In short, is there any way in the unified API to get the user location (without using a Map component, please).

    Wednesday, January 14, 2015 9:18 AM
  • User39 posted

    @SebBE: can you show the code written "by hand" and the full build output you got?

    Wednesday, January 14, 2015 9:23 AM
  • User26481 posted

    Yes of course : you just do a

    CLLocationManager myManager = new CLLocationManager(); myManager.UpdatedLocation += ...

    and you see in the running log a warning about the missing binding for set_delegate. And of course, the method is never called (after a proper StartUpdatingLocation, of course). This is in an untouched project that was giving proper location before the migration.

    Same with Xamarin.Mobile : blank projet, Unified, add latest Xamarin.Mobile. Code is then the trivial

    Geolocator locator = new Geolocator (); locator.DesiredAccuracy = 300.0; Position myPosition = await locator.GetPositionAsync (10000);

    And same warning for the binding problem at first, and await throws an exception about "Method not found".

    Do you get the same result?

    I can only see two explanations : 1) either they really is a missing binding in the Unified API. But in that case, I guess far more people would be complaining about the problem? 2) or somewhere in my components or system, something still calls a pre-Unified binding?

    Hence my question : is anyone getting location using Unified API (in what case we would know that I have to investigate 2).

    Wednesday, January 14, 2015 9:34 AM
  • User78609 posted

    Hi all, Just wondered if there was any progress on this as its holding my development up somewhat.

    Thanks Sam

    Thursday, January 15, 2015 9:27 AM
  • User26481 posted

    I finally solved the problem. I think that, as I finally suspected, some old components were still present, and that CLLocationManager was resolving to a previous version.

    Here is what worked for me :

    • even though I had updated Xamarin.Mobile to 0.7.5, the dll included in the packages was still a 0.7.4. In fact, every time I opened the project, Xamarin.Mobile ended up grayed out or red, even though i did not touch it, and had to remove/reinstall it

    • even in a clean Unified project with just Xamarin.Mobile, i ended up with references to monotouch (which probably explains the resolving problem)

    So I removed all versions of Xamarin.Mobile from my projects, and in the various components directory as well (that's what made it work). Made sure to remove the remaining monotouch references (again, even though I had used the migration feature in some project, or created blank projects, which supposedly should have taken care of this). Re-downloaded 0.7.5 from component store and included it.

    Works as expected now, both using Xamarin.Mobile or direct CLLocationManager call.

    Thursday, January 15, 2015 3:20 PM
  • User78609 posted

    Ok Thanks SebBE, I will start taking a closer look at my code to try and isolate the issue, it seems very likely I have the exact same issue.

    Thursday, January 15, 2015 3:28 PM