hackiftekhar / IQKeyboardManager

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.
MIT License
16.43k stars 2.4k forks source link

value of type "anyObject " has no member drawingplaceholdertext #794

Closed BahaeddinSagar closed 7 years ago

BahaeddinSagar commented 7 years ago

Hello,

When I try to archive the program which uses this keyboard, i get this error (value of type "anyObject " has no member drawingplaceholdertext)


public var shouldHidePlaceholderText: Bool { get { let aValue: AnyObject? = objc_getAssociatedObject(self, &kIQShouldHidePlaceholderText) as AnyObject?

        if let unwrapedValue = aValue as? Bool {
            return unwrapedValue
        } else {
            return false
        }
    }
    set(newValue) {
        objc_setAssociatedObject(self, &kIQShouldHidePlaceholderText, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)

        if let toolbar = self.inputAccessoryView as? IQToolbar {
            if self.responds(to: #selector(getter: UITextField.placeholder)) {
                let textField = self as AnyObject
                toolbar.title = textField.drawingPlaceholderText   //*********** the error is here************
            }
        }
    }
}

however when I compile it for simulated iPhone 5s it runs perfectly

any ideas why this happens ?

Thanks

hackiftekhar commented 7 years ago

First of all, with my library there is no line saying toolbar.title = textField.drawingPlaceholderText However in my library it does have toolbar.title = self.drawingPlaceholderText

I don't know why you are casting self as AnyObject that's why it gives you error, You should cast it to a UIView to fix the issue.

kikoso commented 7 years ago

The version 4.0.4 contains this error inside (toolbar.title = textField.drawingPlaceholderText instead of toolbar.title = self.drawingPlaceholderText). It is required to use 4.0.5 instead. I recommend you updating the README or the Cocoapod corresponding with that version.

gausam commented 6 years ago

@kikoso You life-saver you! 💪