首页 > 解决方案 > 头文件中出现AppDelegate.h file not found错误?

问题描述

当我将目标 c 头文件桥接到 swift 项目时。但是在头文件中,我收到了错误,例如AppDelegate.h找不到文件,也没有在 swift 中调用头函数ViewController。谁能帮我解决以下错误。

//objective c header file:
#import <UIKit/UIKit.h> 

#define UNIVERSAL_RESPONDER         UIResponder <UIApplicationDelegate>
#define UNIVERSAL_WINDOW            UIWindow
#define UNIVERSAL_APPLICATION       UIApplication
#define UNIVERSAL_VIEWCONTROLLER    UIViewController
#define UNIVERSAL_TEXTVIEW          UITextView
#define UNIVERSAL_BUTTON            UIButton
#define UNIVERSAL_VIEW              UIView
#define UNIVERSAL_APP_ARGV          char *

#define UNIVERSAL_APP_MAIN(__argc, __argv, __class)  \
    UIApplicationMain(__argc, __argv, nil, __class)

#define UNIVERSAL_TEXTVIEW_SETTEXT(__textView, __text)  \
    __textView.text = text

#define UNIVERSAL_BUTTON_SETCHECKED(__buttonView, __checked)  \
    [__buttonView setSelected: __checked]

#define UNIVERSAL_BUTTON_GETCHECKED(__buttonView)  \
    __buttonView.selected

#endif 

#import <Foundation/Foundation.h>
#import <SpeechSDK/SpeechRecognitionService.h>


//have to call in swift like this
UNIVERSAL_BUTTON* buttonSel = (UNIVERSAL_BUTTON*)self.buttonGroup[i];
        UNIVERSAL_BUTTON_SETCHECKED(buttonSel, (index == i) ? TRUE : FALSE);

标签: objective-cswift

解决方案


推荐阅读