bool SupportsSecureCoding(Type type)
        {
            Class cls = new Class(type);

            if (!bool_objc_msgSend_IntPtr(cls.Handle, Selector.GetHandle("respondsToSelector:"), Selector.GetHandle("supportsSecureCoding")))
            {
                return(false);
            }

            return(NSSecureCoding.SupportsSecureCoding(type));
        }
示例#2
0
        // [Test] -> iOS 6.0+ and Mountain Lion (10.8) +
        public virtual void SupportsSecureCoding()
        {
            Errors = 0;
            CheckProtocol("NSSecureCoding", delegate(Type type, IntPtr klass, bool result) {
                bool supports = SupportsSecureCoding(type);
                if (result)
                {
                    // check that +supportsSecureCoding returns YES
                    if (!supports)
                    {
#if __IOS__
                        // broken in xcode 12 beta 1 simulator (only)
                        if ((Runtime.Arch == Arch.SIMULATOR) && TestRuntime.CheckXcodeVersion(12, 0))
                        {
                            switch (type.Name)
                            {
                            case "ARFaceGeometry":
                            case "ARPlaneGeometry":
                            case "ARPointCloud":
                            case "ARAnchor":
                            case "ARBodyAnchor":
                            case "AREnvironmentProbeAnchor":
                            case "ARFaceAnchor":
                            case "ARGeoAnchor":
                            case "ARGeometryElement":
                            case "ARGeometrySource":
                            case "ARImageAnchor":
                            case "ARMeshAnchor":
                            case "ARMeshGeometry":
                            case "ARObjectAnchor":
                            case "ARParticipantAnchor":
                            case "ARPlaneAnchor":
                            case "ARReferenceObject":
                            case "ARSkeletonDefinition":                             // iOS15 / device only
                            case "ARWorldMap":
                                return;
                            }
                        }
#endif
                        ReportError("{0} conforms to NSSecureCoding but SupportsSecureCoding returned false", type.Name);
                    }
                }
                else if (type.IsPublic && supports)
                {
                    // there are internal types, e.g. DataWrapper : NSData, that subclass NSSecureCoding-types without
                    // [re-]declaring their allegiance - but we can live with those small betrayals
                    Assert.IsFalse(NSSecureCoding.SupportsSecureCoding(type), "{0} !SupportsSecureCoding", type.Name);
                    ReportError("SupportsSecureCoding returns true but {0} does not conforms to NSSecureCoding", type.Name);
                }
            });
            Assert.AreEqual(Errors, 0, "{0} types conforms to NSCoding but does not implement INSSecureCoding", Errors);
        }
 // [Test] -> iOS 6.0+ and Mountain Lion (10.8) +
 public virtual void SupportsSecureCoding()
 {
     Errors = 0;
     CheckProtocol("NSSecureCoding", delegate(Type type, IntPtr klass, bool result) {
         bool supports = SupportsSecureCoding(type);
         if (result)
         {
             // check that +supportsSecureCoding returns YES
             if (!supports)
             {
                 ReportError("{0} conforms to NSSecureCoding but SupportsSecureCoding returned false", type.Name);
             }
         }
         else if (type.IsPublic && supports)
         {
             // there are internal types, e.g. DataWrapper : NSData, that subclass NSSecureCoding-types without
             // [re-]declaring their allegiance - but we can live with those small betrayals
             Assert.IsFalse(NSSecureCoding.SupportsSecureCoding(type), "{0} !SupportsSecureCoding", type.Name);
             ReportError("SupportsSecureCoding returns true but {0} does not conforms to NSSecureCoding", type.Name);
         }
     });
     Assert.AreEqual(Errors, 0, "{0} types conforms to NSCoding but does not implement INSSecureCoding", Errors);
 }