- Home /
Plugin: How can I get nullable values ?
Writing a geolocator plugin...
This code works properly:
static void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
_Accuracy = args.Position.Coordinate.Accuracy;
_Altitude = 0.0;
_Latitude = args.Position.Coordinate.Latitude;
_Longitude = args.Position.Coordinate.Longitude;
_Timestamp = args.Position.Coordinate.Timestamp;
}
This one fails:
static void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
_Accuracy = args.Position.Coordinate.Accuracy;
_Altitude = args.Position.Coordinate.Altitude.HasValue ? args.Position.Coordinate.Altitude.Value : 0.0;
_Latitude = args.Position.Coordinate.Latitude;
_Longitude = args.Position.Coordinate.Longitude;
_Timestamp = args.Position.Coordinate.Timestamp;
}
Error building Player: Exception: Error: method System.Nullable
1 Windows.Devices.Geolocation.Geocoordinate::get_Altitude()` doesn't exist in target framework. It is referenced from UnityPluginForWindowsPhone.dll at System.Void UnityPluginForWindowsPhone.Location::geolocator_PositionChanged(Windows.Devices.Geolocation.Geolocator,Windows.Devices.Geolocation.PositionChangedEventArgs). Error: method System.Nullable
1 Windows.Devices.Geolocation.Geocoordinate::get_Altitude()` doesn't exist in target framework. It is referenced from UnityPluginForWindowsPhone.dll at System.Void UnityPluginForWindowsPhone.Location::geolocator_PositionChanged(Windows.Devices.Geolocation.Geolocator,Windows.Devices.Geolocation.PositionChangedEventArgs).
Note from MSDN: Values for the Latitude, Longitude, and Accuracy properties are always provided. Values for the Altitude, AltitudeAccuracy, Heading, and Speed properties are provided if available.
How can I get nullable values ?
Your answer
Follow this Question
Related Questions
unable to export visual studio solution using windows phone app plugin 0 Answers
How do I implement In-App purchases for Windows/Windows Phone? 2 Answers
introducing "safe" DLL causes internal compiler error 0 Answers
Integrate Admob in iOS and windows phone 0 Answers
Prime31 azure plugin can't build 0 Answers