     /// Cannot declare a required initializer within an extension.
     /// extension OAuthSwiftCredential: NSCoding {
     public required convenience init?(coder decoder: NSCoder) {
-        
+
         guard let consumerKey = decoder
             .decodeObject(of: NSString.self,
                           forKey: NSCodingKeys.consumerKey) as String? else {
-            let error = CocoaError.error(.coderValueNotFound)
-            decoder.failWithError(error)
+            if #available(iOS 9, *) {
+                let error = CocoaError.error(.coderValueNotFound)
+                decoder.failWithError(error)
+            }
             return nil
         }
 
         guard let consumerSecret = decoder
             .decodeObject(of: NSString.self,
                           forKey: NSCodingKeys.consumerSecret) as String? else {
-            let error = CocoaError.error(.coderValueNotFound)
-            decoder.failWithError(error)
+            if #available(iOS 9, *) {
+                let error = CocoaError.error(.coderValueNotFound)
+                decoder.failWithError(error)
+            }
             return nil
         }
         self.init(consumerKey: consumerKey, consumerSecret: consumerSecret)

        guard let oauthToken = decoder
            .decodeObject(of: NSString.self,
                          forKey: NSCodingKeys.oauthToken) as String? else {
            let error = CocoaError.error(.coderValueNotFound)
            decoder.failWithError(error)
            return nil
        }
        self.oauthToken = oauthToken

        guard let oauthRefreshToken = decoder
            .decodeObject(of: NSString.self,
                          forKey: NSCodingKeys.oauthRefreshToken) as String? else {
            if #available(iOS 9, *) {
                let error = CocoaError.error(.coderValueNotFound)
                decoder.failWithError(error)
            }
            return nil
        }
        self.oauthRefreshToken = oauthRefreshToken
