IsaiasSantana / keyboard_utils

A Flutter plugin to check keyboard visibility.
MIT License
49 stars 49 forks source link

fatal error: 'keyboard_utils/keyboard_utils-Swift.h' file not found #import <keyboard_utils/keyboard_utils-Swift.h> #28

Closed xyzbilal closed 3 years ago

xyzbilal commented 3 years ago

Hi, I am suprisingly start to get this error at title. My ios version 14.3, xcode 12.3 I tried new build system and legacy build system but no success. I could not get what the problem is. here is the build log.

  /Users/bilalsimsek/DevelopmentTools/flutter/.pub-cache/hosted/pub.dartlang.org/keyboard_utils-1.2.4/ios/Classes/KeyboardUtilsPlugin.m:2:9: fatal error: 'keyboard_utils/keyboard_utils-Swift.h' file not found
    #import <keyboard_utils/keyboard_utils-Swift.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    Command CompileSwift failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
seemelala commented 3 years ago

你这个问题是OC和Swift混编导致的 1.项目中Podfile中打开use_frameworks! 2.出现其他项目不能编译就在对应项目的podspec添加s.static_framework = true

seemelala commented 3 years ago

if __has_include(<keyboard_utils/keyboard_utils-Swift.h>)

import <keyboard_utils/keyboard_utils-Swift.h>

else

// Support project import fallback if the generated compatibility header // is not copied when this plugin is created as a library. // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816

import "keyboard_utils-Swift.h"

endif