diff --git a/src/Foundation/NSBundle.cs b/src/Foundation/NSBundle.cs index c9683062acfb..36090d1e1262 100644 --- a/src/Foundation/NSBundle.cs +++ b/src/Foundation/NSBundle.cs @@ -1,43 +1,32 @@ using System; +using System.ComponentModel; using System.Reflection; using System.Collections; using System.Runtime.InteropServices; using ObjCRuntime; -// Disable until we get around to enable + fix any issues. -#nullable disable +#nullable enable namespace Foundation { public partial class NSBundle : NSObject { - -#if !NET - [Obsolete ("Use 'GetLocalizedString' instead.")] - public virtual string LocalizedString (string key, string value, string table) + public NSString GetLocalizedString (string key, string? value = null, string? table = null) { - return (string) GetLocalizedString ((NSString) key, (NSString) value, (NSString) table); + return GetLocalizedString ((NSString) key, (NSString?) value, (NSString?) table); } - [Obsolete ("Use 'GetLocalizedString' instead.")] - public string LocalizedString (string key, string comment) - { - return LocalizedString (key, "", ""); - } - - [Obsolete ("Use 'GetLocalizedString' instead.")] - public string LocalizedString (string key, string val, string table, string comment) - { - return LocalizedString (key, val, table); - } -#endif - public NSString GetLocalizedString (string key, string value = null, string table = null) + public string [] PathsForResources (string fileExtension) { - return GetLocalizedString ((NSString) key, (NSString) value, (NSString) table); + return PathsForResources (fileExtension, null); } - public string [] PathsForResources (string fileExtension) +#if !MONOMAC && !XAMCORE_5_0 + [Obsolete ("Do not use this constructor, it does not work as expected.")] + [EditorBrowsable (EditorBrowsableState.Never)] + public NSBundle () + : base (NSObjectFlag.Empty) { - return PathsForResources (fileExtension, null); } +#endif // !MONOMAC && !XAMCORE_5_0 } } diff --git a/src/foundation.cs b/src/foundation.cs index c74a77d22a0e..f31c7a6bd6cd 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -1047,7 +1047,6 @@ interface NSCachedUrlResponse : NSCoding, NSSecureCoding, NSCopying { } [BaseType (typeof (NSObject))] - // 'init' returns NIL - `init` now marked as NS_UNAVAILABLE [DisableDefaultCtor] interface NSCalendar : NSSecureCoding, NSCopying { [DesignatedInitializer] @@ -5201,8 +5200,6 @@ interface NSLinguisticTag { #endif [BaseType (typeof (NSObject))] - // 'init' returns NIL so it's not usable evenif it does not throw an ObjC exception - // funnily it was "added" in iOS 7 and header files says "do not invoke; not a valid initializer for this class" [DisableDefaultCtor] interface NSLocale : NSSecureCoding, NSCopying { [Static] @@ -8752,6 +8749,10 @@ interface NSUrlRequest : NSSecureCoding, NSMutableCopying { [Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)] [Export ("allowsPersistentDNS")] bool AllowsPersistentDns { get; } + + [TV (18, 2), iOS (18, 2), MacCatalyst (18, 2), Mac (15, 2)] + [Export ("cookiePartitionIdentifier", ArgumentSemantic.Copy), NullAllowed] + string CookiePartitionIdentifier { get; } } [BaseType (typeof (NSDictionary))] @@ -8961,6 +8962,10 @@ interface NSMutableUrlRequest { [Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)] [Export ("allowsPersistentDNS")] bool AllowsPersistentDns { get; set; } + + [TV (18, 2), iOS (18, 2), MacCatalyst (18, 2), Mac (15, 2)] + [Export ("cookiePartitionIdentifier", ArgumentSemantic.Copy), NullAllowed] + string CookiePartitionIdentifier { get; set; } } [BaseType (typeof (NSObject), Name = "NSURLResponse")] @@ -10661,6 +10666,10 @@ interface NSHttpCookie { [MacCatalyst (13, 1)] [NullAllowed, Export ("sameSitePolicy")] NSString SameSitePolicy { get; } + + [TV (18, 2), iOS (18, 2), MacCatalyst (18, 2), Mac (15, 2)] + [Field ("NSHTTPCookieSetByJavaScript")] + NSString KeySetByJavaScript { get; } } [BaseType (typeof (NSObject), Name = "NSHTTPCookieStorage")] @@ -10745,9 +10754,7 @@ interface NSHttpUrlResponse { } [BaseType (typeof (NSObject))] -#if MONOMAC - [DisableDefaultCtor] // An uncaught exception was raised: -[__NSCFDictionary removeObjectForKey:]: attempt to remove nil key -#endif + [DisableDefaultCtor] partial interface NSBundle { [Export ("mainBundle")] [Static] @@ -14965,7 +14972,7 @@ interface NSDateInterval : NSCopying, NSSecureCoding { bool ContainsDate (NSDate date); } - [DisableDefaultCtor] // -init should never be called on NSUnit! + [DisableDefaultCtor] [MacCatalyst (13, 1)] [BaseType (typeof (NSObject))] interface NSUnit : NSCopying, NSSecureCoding { diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index d374cc4a9463..5d822c277b11 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -58766,6 +58766,7 @@ P:Foundation.NSHttpCookie.KeySameSiteLax P:Foundation.NSHttpCookie.KeySameSitePolicy P:Foundation.NSHttpCookie.KeySameSiteStrict P:Foundation.NSHttpCookie.KeySecure +P:Foundation.NSHttpCookie.KeySetByJavaScript P:Foundation.NSHttpCookie.KeyValue P:Foundation.NSHttpCookie.KeyVersion P:Foundation.NSHttpCookieStorage.AcceptPolicyChangedNotification diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-Foundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-Foundation.todo deleted file mode 100644 index c7a52cb0fcd2..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-Foundation.todo +++ /dev/null @@ -1,4 +0,0 @@ -!missing-field! NSHTTPCookieSetByJavaScript not bound -!missing-selector! NSMutableURLRequest::cookiePartitionIdentifier not bound -!missing-selector! NSMutableURLRequest::setCookiePartitionIdentifier: not bound -!missing-selector! NSURLRequest::cookiePartitionIdentifier not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-Foundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/iOS-Foundation.todo deleted file mode 100644 index c7a52cb0fcd2..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-Foundation.todo +++ /dev/null @@ -1,4 +0,0 @@ -!missing-field! NSHTTPCookieSetByJavaScript not bound -!missing-selector! NSMutableURLRequest::cookiePartitionIdentifier not bound -!missing-selector! NSMutableURLRequest::setCookiePartitionIdentifier: not bound -!missing-selector! NSURLRequest::cookiePartitionIdentifier not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-Foundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-Foundation.todo deleted file mode 100644 index c7a52cb0fcd2..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-Foundation.todo +++ /dev/null @@ -1,4 +0,0 @@ -!missing-field! NSHTTPCookieSetByJavaScript not bound -!missing-selector! NSMutableURLRequest::cookiePartitionIdentifier not bound -!missing-selector! NSMutableURLRequest::setCookiePartitionIdentifier: not bound -!missing-selector! NSURLRequest::cookiePartitionIdentifier not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-Foundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-Foundation.todo deleted file mode 100644 index c7a52cb0fcd2..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-Foundation.todo +++ /dev/null @@ -1,4 +0,0 @@ -!missing-field! NSHTTPCookieSetByJavaScript not bound -!missing-selector! NSMutableURLRequest::cookiePartitionIdentifier not bound -!missing-selector! NSMutableURLRequest::setCookiePartitionIdentifier: not bound -!missing-selector! NSURLRequest::cookiePartitionIdentifier not bound