@@ -135,12 +135,16 @@ class TestUserInfo : TestUserInfoSuper {
135
135
func test_classForCoder( ) {
136
136
// confirm internal bridged impl types are not exposed to archival machinery
137
137
// we have to be circuitous here, as bridging makes it very difficult to confirm this
138
- let note = Notification ( name: Notification . Name ( rawValue: " TestSwiftNotification " ) , userInfo: [ AnyHashable ( " key " ) : " value " ] )
139
- let archivedNote = NSKeyedArchiver . archivedData ( withRootObject: note)
140
- let noteAsPlist = try ! PropertyListSerialization . propertyList ( from: archivedNote, options: [ ] , format: nil )
141
- let plistAsData = try ! PropertyListSerialization . data ( fromPropertyList: noteAsPlist, format: . xml, options: 0 )
142
- let xml = NSString ( data: plistAsData, encoding: String . Encoding. utf8. rawValue) !
143
- expectEqual ( xml. range ( of: " _NSUserInfoDictionary " ) . location, NSNotFound)
138
+ //
139
+ // Gated on the availability of NSKeyedArchiver.archivedData(withRootObject:).
140
+ if #available( macOS 10 . 11 , iOS 9 . 0 , tvOS 9 . 0 , watchOS 2 . 0 , * ) {
141
+ let note = Notification ( name: Notification . Name ( rawValue: " TestSwiftNotification " ) , userInfo: [ AnyHashable ( " key " ) : " value " ] )
142
+ let archivedNote = NSKeyedArchiver . archivedData ( withRootObject: note)
143
+ let noteAsPlist = try ! PropertyListSerialization . propertyList ( from: archivedNote, options: [ ] , format: nil )
144
+ let plistAsData = try ! PropertyListSerialization . data ( fromPropertyList: noteAsPlist, format: . xml, options: 0 )
145
+ let xml = NSString ( data: plistAsData, encoding: String . Encoding. utf8. rawValue) !
146
+ expectEqual ( xml. range ( of: " _NSUserInfoDictionary " ) . location, NSNotFound)
147
+ }
144
148
}
145
149
146
150
func test_AnyHashableContainingNotification( ) {
0 commit comments