1

I want to use IQKeyboardManager for managing the keyboard when using a UITextField or a UITextView. I'm using Xcode and Swift. I don't use CocoaPods, I want to use the Source Code Method.

These are the steps I'm doing.

  1. Opening the project and moving the IQKeyboardManagerSwift folder into the left sidebar of my Xcode project. Here's a screenshot of it: IQKeyboardManagerSwift folder in Xcode sidebar

  2. Then I changed the code in AppDelegate.swift like this:

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        IQKeyboardManager.sharedManager().enable = true
    
        return true
    }
    

But I'm getting Use of unresolved identifier 'IQKeyboardManager' for IQKeyboardManager.sharedManager().enable = true.

What am I doing wrong? I exactly followed the manual and I already read it hundreds times but couldn't get it working.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223

4 Answers4

1

When you drag and drop the 'IQKeyboardManagerSwift' folder make sure you choose 'CREATE GROUPS' instead of 'CREATE FOLDER REFERENCES'. That should solve the issue.

I found this solution on here

Andi
  • 8,154
  • 3
  • 30
  • 34
0

Make sure of these points:-

1.) You have imported the library:-

          import IQKeyboardManagerSwift

2.)Make sure two cocoapods are not installed because if they are it confuses XCode to where to pick this dependency from

Reference from:- https://stackoverflow.com/a/38918522/6297658

First check the swift and Xcode version that you are using and if that version support the pod file you are using

Swift 2.2 (Xcode 7.3) Use:-

pod 'IQKeyboardManagerSwift'

Or

pod 'IQKeyboardManagerSwift', '4.0.3'

For Swift 2.1.1 (Xcode 7.2) Use :-

pod 'IQKeyboardManagerSwift', '4.0.0'

For Swift 2.0 (Xcode 7.0) Use :-

pod 'IQKeyboardManagerSwift', '3.3.3.1' I had similar problem , turns out i had two Cocoapods instances installed, This is a Cocoapods issue not an Xcode one (in my case it was').

All i needed to do was uninstall my cocoapod and reinstall it https://stackoverflow.com/a/27940867/6297658...... This worked for me...

Once you are done reinstalling go to your pod file add pods according to the version of swift and Xcode you are using and then run pod install

PS: Cocoapods REPO is nearly 350MB, so if your download is stuck don't just quit Terminal and start reinstalling again first uninstall Cocoapods and old master repo both completely, then start installing again ... this is probably what caused two instances of it in my case

  • If you are installing the library in objective-C manually then you will have to to include Header Search Path, Bridging Header
Community
  • 1
  • 1
Dravidian
  • 9,945
  • 3
  • 34
  • 74
  • Hi, thanks for your answer. But I'm not using CocoaPods and I don't want to use it. I wanted to install it with the `Source Code Method`. Do you know what I'm doing wrong? –  Sep 03 '16 at 15:31
  • Your answer still didn't help me. I want to use the `Source Code Method`. –  Sep 04 '16 at 07:11
  • Hi, @Dravidian, thanks for asking. Unfortunately I still didn't solve this issue. I don't want to use CocoaPods. Can you help me, please? –  Sep 10 '16 at 19:25
  • Are you using swift framework or Obj-C?Did you update other linker flags in build settings? – Dravidian Sep 10 '16 at 19:30
0

I know that this Question was asked 3 years ago. But today I faced the same issue. So now I am answering how did I solve it hoping that my answer will help someone in future.

  1. as arauter said, When you drag and drop the 'IQKeyboardManagerSwift' folder make sure you choose 'CREATE GROUPS' instead of 'CREATE FOLDER REFERENCES'. That should solve the issue.

  2. Go to your TARGETS -> Build Phases -> Compile Sources, And add every single files that contains in 'IQKeyboardManagerSwift' Directory.

That's it. It will work!!

Naval Hasan
  • 1,226
  • 1
  • 13
  • 18
-1

The simplest workaround would be to use the CocoaPods Method. CocoaPods takes care of all the dependencies stuffs. It will save you hours of headache !

At least, take a few minutes to read the CocoaPods Get Started page.

Julien Quere
  • 2,407
  • 16
  • 21
  • Your answer didn't help me. I want to use the `Source Code Method`. –  Sep 04 '16 at 07:11