ios 架构 i386 的未定义符号:_OBJC_CLASS_$_SKPSMTPMessage”,引用自:错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6984368/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 21:00:41  来源:igfitidea点击:

Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error

iosobjective-ciphonecompiler-errorsemail-integration

提问by Mann

I have imported framework for sending email from application in background i.e. SKPSMTPMessageFramework. Can somebody suggest why below error is shown

我已经导入了从后台应用程序发送电子邮件的框架,即SKPSMTPMessage框架。有人可以建议为什么显示以下错误

Undefined symbols for architecture i386:

"_OBJC_CLASS_$_SKPSMTPMessage", referenced from:
  objc-class-ref in ConfirmController.o

"_kSKPSMTPPartContentTransferEncodingKey", referenced from:
  -[ConfirmController sendEmail] in ConfirmController.o

"_kSKPSMTPPartMessageKey", referenced from:
  -[ConfirmController sendEmail] in ConfirmController.o

"_kSKPSMTPPartContentTypeKey", referenced from:
  -[ConfirmController sendEmail] in ConfirmController.o

ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

Source from which framework is taken:-

取自哪个框架的来源:-

Locking the Fields in MFMailComposeViewController

锁定 MFMailComposeViewController 中的字段

Update:

更新

Answer:Just drag and drop folder over the project and click copy. Thats it select project check box and target check box as well.

答:只需将文件夹拖放到项目上,然后单击复制。那就是选择项目复选框和目标复选框。

回答by Allen Pike

You can get this type of error if your class' .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target. Normally Xcode does this for you, but sometimes it loses the plot and you need to add the .m file manually.

如果您的类的 .m 文件未列在目标的“构建阶段”选项卡的“编译源”步骤下,您可能会收到此类错误。通常 Xcode 会为您执行此操作,但有时它会丢失绘图,您需要手动添加 .m 文件。

To do this:

去做这个:

TargetSettings -> Build Phases -> Compile Sources -> add your .m class ->Build and Run

TargetSettings -> Build Phases -> Compile Sources -> 添加你的 .m 类 -> Build and Run

回答by verma

for me the issue turned out to be missing frameworks. Once I added em, it worked.

对我来说,问题是缺少框架。一旦我添加了它们,它就起作用了。

回答by Akshay

Check the Valid Architectures & Build Active Architecture only properties.

检查 Valid Architectures & Build Active Architecture only 属性。

enter image description here

在此处输入图片说明

回答by Tim

if you are using cocoapods make sure your target's build settings contain $(inherited)in the other linker flagssection

如果您使用的是 cocoapods,请确保您的目标的构建设置在其他链接器标志部分中包含$(inherited)

enter image description here

在此处输入图片说明

回答by Owen Hartnett

Is your framework compiled for armv(x)? It looks to me like it's compiled for i386, which code won't run on an iOS device. Or else it's compiled for armv(x) and you're trying to run it on the simulator, which is i386 code. Make sure, using the build settings Akshay displayed above, that your framework is correctly compiled for the chip you're going to run it on.

你的框架是为 armv(x) 编译的吗?在我看来,它是为 i386 编译的,该代码不会在 iOS 设备上运行。否则它是为 armv(x) 编译的,而你正试图在模拟器上运行它,这是 i386 代码。确保使用上面显示的构建设置 Akshay,您的框架已针对要运行它的芯片正确编译。

回答by star18bit

If you importing some other project in xcode and if current and import project both have same files in Compiler source then just remove same file in current project in "Build phase' settings. It worked for me.

如果您在 xcode 中导入其他项目,并且当前项目和导入项目在编译器源中都有相同的文件,那么只需在“构建阶段”设置中删除当前项目中的相同文件。它对我有用。

回答by Gabriel Ramirez

Also could be that you're missing to link against a Binary Library, check Build Phases in your Targes add required libraries and then Product > Clean Product > Build

也可能是您缺少链接二进制库,检查目标中的构建阶段添加所需的库,然后产品 > 清洁产品 > 构建

That must work too!

这也必须工作!

回答by kraftydevil

I had this issue when I opened the same project twice, only one project was the original and the other was cloned from a git url.

我两次打开同一个项目时遇到了这个问题,只有一个项目是原始项目,另一个是从 git url 克隆的。

'Product' > 'Clean' solved the problem.

“产品”>“清洁”解决了这个问题。

回答by abbood

try this one last:

最后试试这个:

so I tried all the suggestions on this page.. none worked.. The way my problem started was by following the steps in thistutorial that teaches how to link static libraries. With my sample project the instructions worked fine.. but then on my actual project I started getting the error above.

所以我尝试了此页面上的所有建议.. 都没有奏效.. 我的问题开始的方式是按照教程中的步骤来教如何链接静态库。在我的示例项目中,说明工作正常......但是在我的实际项目中,我开始收到上述错误。

So what I did was go through each step of the said tutorialand built after each step.. the offending line turned out to be this one: adding -all_load to build settings-> other linker flags

所以我所做的是完成上述教程的每一步并在每一步之后构建..结果是有问题的行是这样的:添加 -all_load 来构建设置-> 其他链接器标志

it turns out that this flag was recommendedonce upon a time to link categories to static libraries.. but then it turned outthat this flag was no longer necessary Xcode 4.2+.. (same goes for the -force_load flag.. which was also recommended in other posts)..

事实证明,这个标志被推荐仙界链接类别静态库一次..但后来证明,这个标志是不再需要的Xcode 4.2以上版本。(同样适用于-force_load标志..这也是在其他帖子中推荐)。

回答by yeahdixon

Yeah this is related to what allen said... look for TargetMembership in Utilities section of the source file. there is a checkbox that associates that file to a project. Checking this solved this issue for me too.

是的,这与 allen 所说的有关...在源文件的实用程序部分查找 TargetMembership。有一个复选框将该文件与项目相关联。检查这个也为我解决了这个问题。