ios 未找到自动链接框架

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49767974/
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-31 09:41:47  来源:igfitidea点击:

Auto-Linking framework not found

iosswiftxcodeframeworks

提问by user3122959

I have forked a framework called BTNavigationDropdownMenu(swift project for ios). all worked fine till I tried to add a dependency to the latest version in the branch I created. the problem is the same whether I add the other framework (DYBadge) through a podfile or through Carthage.

我已经创建了一个名为BTNavigationDropdownMenu(ios 的 swift 项目)的框架。一切正常,直到我尝试向我创建的分支中的最新版本添加依赖项。无论我是DYBadge通过 podfile 还是通过Carthage.

Auto-Linking framework not found DYBadge.

未找到自动链接框架DYBadge

It seems to have a problem with a UIViewextension that is part of DYBadge.

它似乎有一个问题,一个UIView扩展名是一部分DYBadge

DYBadgeworks fine in my main app I'm working on (I also need it in the app target).

DYBadge在我正在开发的主应用程序中工作正常(我在应用程序目标中也需要它)。

errors below. thanks for any hints into the right direction.

下面的错误。感谢您对正确方向的任何提示。

ld: warning: Auto-Linking framework not found DYBadge Undefined symbols for architecture x86_64: "(extension in DYBadge):__ObjC.UIView.getBadge() -> DYBadge.DYBadge?", referenced from: Demo.BTNavigationDropdownMenu.updateBadge(text: Swift.String, at: Swift.Int) -> () in BTNavigationDropdownMenu.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld:警告:未找到自动链接框架 DYBadge 架构 x86_64 的未定义符号:“(DYBadge 中的扩展):__ObjC.UIView.getBadge() -> DYBadge.DYBadge?”,引用自:Demo.BTNavigationDropdownMenu.updateBadge(text: Swift.String, at: Swift.Int) -> () in BTNavigationDropdownMenu.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

回答by palme

Xcode is not able to find your frameworks because the FRAMEWORK_SEARCH_PATHSis probably not set or is wrong (happened to me because I moved the Info.plistfile).

Xcode 无法找到您的框架,因为FRAMEWORK_SEARCH_PATHS它可能未设置或错误(发生在我身上,因为我移动了Info.plist文件)。

You can fix this by going into your target and adapt the Build Settings. Simply search in there for FRAMEWORK_SEARCH_PATHSand add the correct one, which is usually $(PROJECT_DIR)/Carthage/Build/iOS(for iOS projects). $(inherited)should also be in there as the first entry.

您可以通过进入目标并调整构建设置来解决此问题。只需在那里搜索FRAMEWORK_SEARCH_PATHS并添加正确的,通常是$(PROJECT_DIR)/Carthage/Build/iOS(对于 iOS 项目)。$(inherited)也应该在那里作为第一个条目。

This is the post of @user3122959 answer in the comments, which helped me and others to fix this problem and was requested to put in as the answer to this question.

这是评论中@user3122959 回答的帖子,它帮助我和其他人解决了这个问题,并被要求作为这个问题的答案。

回答by Declan McKenna

I had this problem accessing 3rd party frameworks from my tests. Here's how I fixed it.

我在从测试中访问 3rd 方框架时遇到了这个问题。这是我修复它的方法。

  1. In Xcode goto: Your Unit-Test target > Build Phases > Link Binary With Libraries

  2. In Finder goto: Carthage > Build > yourframework.Framework

  3. Drag the framework in to your build phases then clean (cmd - shift - K).

  1. 在 Xcode 中转到: Your Unit-Test target > Build Phases > Link Binary With Libraries

  2. 在 Finder 中转到: Carthage > Build > yourframework.Framework

  3. 将框架拖入构建阶段,然后清理(cmd - shift - K)。

回答by Md Rashed Pervez

Try this process -

试试这个过程——

  1. Press "Cmd + Shift + K"or shift + cmd + alt + kto clean up, and quit Xcode.
  2. Delete the cache Run "rm -rf ~/Library/Developer/Xcode/DerivedData"in terminal
  3. Open the project and re-buildit
  1. "Cmd + Shift + K"shift + cmd + alt + k进行清理,然后退出 Xcode。
  2. 删除缓存"rm -rf ~/Library/Developer/Xcode/DerivedData"在终端运行
  3. 打开项目和re-build

回答by Secondwave

This can also be an error if you use a framework that has Bitcode Enabled on false. Bitcode Enabled can only be true if all frameworks also have Bitcode enabled true. Go to your targets build settings and disable bitcode.

如果您使用的框架在 false 上启用了 Bitcode,这也可能是一个错误。只有当所有框架都启用了 Bitcode 时,Bitcode Enabled 才能为 true。转到您的目标构建设置并禁用位码。

回答by swift2geek

If you are using Carthage and several Projects within one Workspace you have to add a symlink to your Main Carthage Folder. it will depend what structure you have, but for example if you have

如果您在一个工作区中使用 Carthage 和多个项目,则必须向您的主 Carthage 文件夹添加符号链接。这将取决于你有什么结构,但例如,如果你有

Project -> Carthage

项目 -> 迦太基

Project -> Frameworks -> MyImbaFramework than cd in terminal in MyImbaFramework folder and run

Project -> Frameworks -> MyImbaFramework 而不是 cd 在 MyImbaFramework 文件夹中的终端并运行

ln -s ../../Carthage Carthage

ln -s ../../Carthage Carthage

回答by Mazyod

In my case, there was an issue with Bitcode, but Xcode couldn't give an accurate error diagnostic since the project framework references were also somehow messed up. Running the framework tests worked fine, but archiving gave the auto-linking error.

就我而言,Bitcode 存在问题,但 Xcode 无法给出准确的错误诊断,因为项目框架引用也以某种方式混乱。运行框架测试工作正常,但存档会出现自动链接错误。

Deleted all framework references from the project, including the Frameworksgroup they were under, added them back again resolved the references issue, then I got the bitcode issue, which I disabled on the target framework, then and only then, archiving was successful

从项目中删除了所有框架引用,包括Frameworks它们所属的组,再次添加它们解决了引用问题,然后我遇到了位码问题,我在目标框架上禁用了该问题,然后才成功存档