From e3254e97d187357a6c7f8372798d48c190af2198 Mon Sep 17 00:00:00 2001 From: Alex Soto Date: Thu, 15 Jun 2017 15:17:20 -0500 Subject: [PATCH 1/2] [CoreLocation] Update to Xcode 9 Beta 1 --- src/corelocation.cs | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/src/corelocation.cs b/src/corelocation.cs index dd8401c95bc3..590d0fe88322 100644 --- a/src/corelocation.cs +++ b/src/corelocation.cs @@ -16,6 +16,9 @@ #if !MONOMAC using XamCore.UIKit; #endif +#if XAMCORE_2_0 && !TVOS +using XamCore.Contacts; +#endif using System; namespace XamCore.CoreLocation { @@ -387,8 +390,8 @@ partial interface CLLocationManager { [Export ("requestLocation")] void RequestLocation (); - [NoWatch][NoTV] - [iOS (9,0)] + [NoTV] + [iOS (9,0), Watch (4,0)] [Export ("allowsBackgroundLocationUpdates")] bool AllowsBackgroundLocationUpdates { get; set; } #endif @@ -539,6 +542,9 @@ partial interface CLRegion : NSSecureCoding, NSCopying { [BaseType (typeof (NSObject))] [DisableDefaultCtor] // will crash, see CoreLocation.cs for compatibility stubs interface CLPlacemark : NSSecureCoding, NSCopying { + [Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'CLPlacemark' properties to access data.")] + [Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CLPlacemark' properties to access data.")] + [Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'CLPlacemark' properties to access data.")] [Export("addressDictionary", ArgumentSemantic.Copy)] NSDictionary AddressDictionary { get; } @@ -593,6 +599,12 @@ interface CLPlacemark : NSSecureCoding, NSCopying { [Export ("timeZone")] [iOS (9,0), Mac(10,11)] NSTimeZone TimeZone { get; } +#if XAMCORE_2_0 && !TVOS + // From CLPlacemark (ContactsAdditions) category. + [Watch (4,0), NoTV, Mac (10,13), iOS (11,0)] + [NullAllowed, Export ("postalAddress")] + CNPostalAddress PostalAddress { get; } +#endif } [Mac (10,10)] @@ -684,6 +696,14 @@ interface CLGeocoder { [Async] void ReverseGeocodeLocation (CLLocation location, CLGeocodeCompletionHandler completionHandler); + [Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)] + [Export ("reverseGeocodeLocation:preferredLocale:completionHandler:")] + [Async] + void ReverseGeocodeLocation (CLLocation location, [NullAllowed] NSLocale locale, CLGeocodeCompletionHandler completionHandler); + + [Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'GeocodeAddress (string, CLRegion, NSLocale, CLGeocodeCompletionHandler)' instead.")] + [Deprecated (PlatformName.iOS, 11, 0, message: "Use 'GeocodeAddress (string, CLRegion, NSLocale, CLGeocodeCompletionHandler)' instead.")] + [Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'GeocodeAddress (string, CLRegion, NSLocale, CLGeocodeCompletionHandler)' instead.")] [Export ("geocodeAddressDictionary:completionHandler:")] [Async] void GeocodeAddress (NSDictionary addressDictionary, CLGeocodeCompletionHandler completionHandler); @@ -696,10 +716,31 @@ interface CLGeocoder { [Async] void GeocodeAddress (string addressString, CLRegion region, CLGeocodeCompletionHandler completionHandler); + [Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)] + [Async] + [Export ("geocodeAddressString:inRegion:preferredLocale:completionHandler:")] + void GeocodeAddress (string addressString, [NullAllowed] CLRegion region, [NullAllowed] NSLocale locale, CLGeocodeCompletionHandler completionHandler); + [Export ("cancelGeocode")] void CancelGeocode (); } +#if XAMCORE_2_0 && !TVOS + [Category] + [BaseType (typeof (CLGeocoder))] + interface CLGeocoder_ContactsAdditions { + [Watch (4,0), NoTV, Mac (10,13), iOS (11,0)] + [Export ("geocodePostalAddress:completionHandler:")] + // [Async] Generates invalid code: https://bugzilla.xamarin.com/show_bug.cgi?id=57531 + void GeocodePostalAddress (CNPostalAddress postalAddress, CLGeocodeCompletionHandler completionHandler); + + [Watch (4,0), NoTV, Mac (10,13), iOS (11,0)] + [Export ("geocodePostalAddress:preferredLocale:completionHandler:")] + // [Async] Generates invalid code: https://bugzilla.xamarin.com/show_bug.cgi?id=57531 + void GeocodePostalAddress (CNPostalAddress postalAddress, [NullAllowed] NSLocale locale, CLGeocodeCompletionHandler completionHandler); + } +#endif + #if !MONOMAC [NoWatch][NoTV] [iOS (8,0)] From c01329575244e1c7b4d016396c5ec69373a6d969 Mon Sep 17 00:00:00 2001 From: Alex Soto Date: Fri, 16 Jun 2017 21:45:06 -0500 Subject: [PATCH 2/2] [CoreLocation] Inline CLGeocoder_ContactsAdditions so we get Async versions --- src/corelocation.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/corelocation.cs b/src/corelocation.cs index 590d0fe88322..d0689560cb04 100644 --- a/src/corelocation.cs +++ b/src/corelocation.cs @@ -723,23 +723,19 @@ interface CLGeocoder { [Export ("cancelGeocode")] void CancelGeocode (); - } #if XAMCORE_2_0 && !TVOS - [Category] - [BaseType (typeof (CLGeocoder))] - interface CLGeocoder_ContactsAdditions { [Watch (4,0), NoTV, Mac (10,13), iOS (11,0)] [Export ("geocodePostalAddress:completionHandler:")] - // [Async] Generates invalid code: https://bugzilla.xamarin.com/show_bug.cgi?id=57531 + [Async] void GeocodePostalAddress (CNPostalAddress postalAddress, CLGeocodeCompletionHandler completionHandler); [Watch (4,0), NoTV, Mac (10,13), iOS (11,0)] [Export ("geocodePostalAddress:preferredLocale:completionHandler:")] - // [Async] Generates invalid code: https://bugzilla.xamarin.com/show_bug.cgi?id=57531 + [Async] void GeocodePostalAddress (CNPostalAddress postalAddress, [NullAllowed] NSLocale locale, CLGeocodeCompletionHandler completionHandler); - } #endif + } #if !MONOMAC [NoWatch][NoTV]