将Swift导入Objective-c后出现错误 [英] error after importing Swift into Objective-c
问题描述
我尝试在OC中使用swift,因此我将定义模块YES 设置为产品模块名称和产品名称,然后导入ProductName-我想在其中使用swift的.m文件中的Swift.h"
I try to use swift in OC,so I set Defines Module YES set Product Module Name with Product Name and "import ProductName-Swift.h" in the .m file where i wanted to use swift
但是该项目无法运行,在"ProductName-Swift.h"中引起很多错误
but the project cannot run ,cause a lot of mistakes in the "ProductName-Swift.h"
AppDelegate.swift似乎有问题,如何解决此问题
it seems something wrong with AppDelegate.swift,how to resolve this problem
推荐答案
我对MapKit框架有同样的问题,编译器指向ProductName-Swift.h文件中缺少MKMapViewDelegate的声明.为了解决这个问题,我添加了
#import <MapKit/MapKit.h>
在桥头文件PoductName-Bridging-Header.h中.
I have the same problem with MapKit framework, compiler pointed on missed declaration of MKMapViewDelegate in ProductName-Swift.h file. To solve this problem i added
#import <MapKit/MapKit.h>
in bridge header file PoductName-Bridging-Header.h.
您可以尝试将UIApplicationDelegate添加到此标头.希望对您有帮助.
You can try to add UIApplicationDelegate to this header. I hope this will help you.
这篇关于将Swift导入Objective-c后出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!