我的 Xamarin.iOS 代码在此处以防万一:
...
using CoreLocation;
...
// Start scanning for beacons
void StartScanningForBeacons()
{
#region
//var Uuid = new NSUuid();
//var BeaconRegion = new CLBeaconRegion(Uuid,BeaconId);
LocationManager.RequestWhenInUseAuthorization();
#endregion
// Start ranging beacons
LocationManager.StartRangingBeacons(BeaconRegion);
// DidRangeBeacons
LocationManager.DidRangeBeacons += (object sender, CLRegionBeaconsRangedEventArgs e) =>
{
// Push beacons' information onto screen
//Create Alert
var okAlertController = UIAlertController.Create("Title", "We found " + e.Beacons.Length + " beacon(s)\nmajor: " + e.Beacons[0].Major, UIAlertControllerStyle.Alert);
//Add Action
okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
// Present Alert
PresentViewController(okAlertController, true, null);
// DisplayBeaconsInformation(e.Beacons);
};
}
...
所以,我的问题是,我们可以在Xamarin.Forms中实现特定的iOS框架,然后从我的Xamarin.iOS复制整个代码并期望它在Android和iOS平台上运行吗?