问题标签 [swift-framework]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
605 浏览

swift - 使用通用脚本进行框架构建时,Xcode 访问构建数据库时出错

我正在尝试使用从这里获得的以下通用框架脚本构建一个包含 cocoapods 的 Swift 框架:Swift 通用框架取决于 pod

使用 Xcode 12 和时构建失败-UseModernBuildSystem=NO

旧版构建系统将在未来的版本中删除。您可以在文件 > 工作区设置中配置选定的构建系统和此弃用消息。
命令 PhaseScriptExecution 失败,退出代码非零

使用 Xcode 12 和现代构建系统时出错:

错误:访问构建数据库
“/Users/user/Library/Developer/Xcode/DerivedData/SnapKit-gldcozqrglacwhcqsctatmsoiouc/Build/Intermediates.noindex/XCBuildData/build.db”:磁盘I/O错误

有谁知道这个问题的正确解决方案或解决方法?

0 投票
2 回答
2193 浏览

ios-frameworks - 自定义框架:dyld:找不到符号:_$s11CryptoSwift7PaddingO5pkcs7yA2CmFWC

我正在使用使用 3 个不同的 cocoapods 创建的自定义框架。我通过删除创建的 xc 框架在客户端应用程序中使用此自定义框架。一旦客户端应用程序启动,它就会崩溃并显示以下崩溃日志。我已经看到这个问题在苹果和 stackoverflow 上报告了许多其他地方,但我找不到适合我的正确答案。现在我已经将客户端应用程序和框架 repo 都上传到了 github,这样任何试图帮助我的人都可以真正看到设置和代码。请任何人都可以建议一个适当的解决方案来解决这个问题。

框架:https ://github.com/deepesh259nitk/PaymentsKit

客户端应用程序:https ://github.com/deepesh259nitk/PaymentClient

应用启动时的崩溃日志

dyld:找不到符号:$s11CryptoSwift7PaddingO5pkcs7yA2CmFWC 引用自:/Users/deepesh.vasthimal/Library/Developer/Xcode/DerivedData/PaymentClient-bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator/PaymentsKit.framework/PaymentsKit 预期在:/Users/deepesh .vasthimal/Library/Developer/CoreSimulator/Devices/A0876375-98D5-4215-A139-68F29E787388/data/Containers/Bundle/Application/D954732B-EDDC-478E-85C4-C5C9B14FDDEE/PaymentClient.app/Frameworks/CryptoSwift.framework/CryptoSwift在/Users/deepesh.vasthimal/Library/Developer/Xcode/DerivedData/PaymentClient-bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator/PaymentsKit.framework/PaymentsKit dyld:启动,加载依赖库DYLDSHAREDCACHEDIR=/Users/deepesh.vasthimal/Library /Developer/CoreSimulator/Caches/dyld/19H2/com.apple.CoreSimulator.SimRuntime。iOS-14-0.18A372 DYLDROOTPATH=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLDLIBRARYPATH=/Users/deepesh.vasthimal/Library/Developer/Xcode/DerivedData/PaymentClient-bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator:/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS。 platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/ iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/de18A372 DYLDROOTPATH=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLDLIBRARYPATH=/Users/ deepesh.vasthimal/Library/Developer/Xcode/DerivedData/PaymentClient-bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator:/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer /CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library /Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/de18A372 DYLDROOTPATH=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLDLIBRARYPATH=/Users/ deepesh.vasthimal/Library/Developer/Xcode/DerivedData/PaymentClient-bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator:/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer /CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library /Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/de巨大/下载/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLDLIBRARYPATH=/Users/deepesh.vasthimal/Library/Developer/ Xcode/DerivedData/PaymentClient-bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator:/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS .simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes /iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/de巨大/下载/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLDLIBRARYPATH=/Users/deepesh.vasthimal/Library/Developer/ Xcode/DerivedData/PaymentClient-bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator:/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS .simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes /iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/deapp/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLDLIBRARYPATH=/Users/deepesh.vasthimal/Library/Developer/Xcode/DerivedData/PaymentClient- bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator:/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources /RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents /Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/deapp/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLDLIBRARYPATH=/Users/deepesh.vasthimal/Library/Developer/Xcode/DerivedData/PaymentClient- bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator:/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources /RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents /Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/desimruntime/Contents/Resources/RuntimeRoot DYLDLIBRARYPATH=/Users/deepesh.vasthimal/Library/Developer/Xcode/DerivedData/PaymentClient-bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator:/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents /Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app /Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/desimruntime/Contents/Resources/RuntimeRoot DYLDLIBRARYPATH=/Users/deepesh.vasthimal/Library/Developer/Xcode/DerivedData/PaymentClient-bnsircrdeaciebedmqaliyxezdqe/Build/Products/Debug-iphonesimulator:/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents /Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app /Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/de/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording .dylib:/用户/de/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Users/deepesh.vasthimal/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording .dylib:/用户/desimruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/desimruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/de

我尝试过的事情。

  1. 我尝试完全删除 CryptoSwift 以查看是否由于此 pod 发生错误,但随后崩溃发生在另一个 pod 的 JOSESwift 上。
  2. 我已经意识到崩溃的发生是因为它在 CryptoSwift 和 JOSESwift 中都找不到特定的符号。而且当我使用这些库的特定方法时。

例如,如果我使用 CryptoSwift 的 AES 方法,如果您看到我的框架 repo,通过添加以下代码会发生崩溃,仅包含 pod 不会崩溃,但使用它会导致崩溃。

_$s11CryptoSwift7PaddingO5pkcs7yA2CmFWC

  1. 我还在客户端应用程序中添加 pod,这样如果您看到客户端应用程序 repo,它不会被添加两次,您将看到所有 3 个 pod 都已添加。
0 投票
2 回答
165 浏览

ios - 将 Swift 框架嵌入到另一个框架 Xcode

我基本上有两个在 Xcode 上运行的框架。“ResearchKit”和“AppMethods”。虽然一切正常,但“AppMethods”框架使用“ResearchKit”中的代码。事实上,它可以将更多方法抽象到框架中。一种超类。

在代码中使用它们时,我必须导入两个框架

有没有办法在 AppMethods 中嵌入 ResearchKit,这样我只需要导入AppMethods. 没有ResearchKitAppMethods就不会存在。

0 投票
0 回答
369 浏览

swift - SwiftUI Preview 找不到使用过的框架的图像

我的项目由一个主要的 iOS 应用程序项目和三个额外的演示、域和数据层框架组成。我自己的框架嵌入在主要目标中。第三方框架由 CocoaPods 管理并动态链接。

现在,如果我尝试预览我的代码,我会收到以下错误:

我希望我包括了所有相关信息。如果我忘记了什么,请随时提出要求。

0 投票
0 回答
81 浏览

swift - 如何访问可在 CocoaPods 和 Swift 包管理器上运行的资产资源?

根据我目前的经验以及我在此处的苹果文档中阅读的内容,在访问 Swift 包管理器中的资源时,我们必须始终使用 Bundle.module,如下所示:

但这在创建框架时就不一样了。对于框架,我们应该像这样使用包标识符:

编译器甚至无法识别 SPM 范围之外的 Bundle.module,所以如果我想创建一个可以使用 CocoaPodsSPM 安装的框架(这是我想要实现的),我不能使用Bundle.module 导致 Pod 无法识别它,并且我无法使用捆绑标识符,导致 SPM 无法识别它。

那么我应该在这里做什么?在这两种情况下如何访问相同的资源?

在 SPM 中包含资产相对较新,所以我找不到任何资源来向我解释这一点,如果有人能解释如何去做,我将非常感激 :)

与此同时,我会继续研究和尝试不同的东西,所以如果我找到答案,我会在这里发布我的发现。

0 投票
0 回答
18 浏览

ios-frameworks - 我们如何在 iOS 的自定义框架中嵌入第三方框架

我需要在我的自定义框架中添加一个静态框架。我的自定义框架中有 pod,但由于采用者的依赖问题,我需要添加静态。我收到以下错误。

dyld:库未加载:@rpath/StaticFramework.framework/StaticFramework.framework 引用自:/private/var/containers/Bundle/Application/08DDE5B5-D741-43EC-99FD-EA68FAF9519B/Adopter.app/Frameworks/Custom.framework/自定义原因:找不到图片

这里静态框架添加到自定义框架中,但采用者应用程序面临上述问题。

自定义框架中可能缺少一些所需的设置。

0 投票
1 回答
36 浏览

swift - 照片资产迭代

我正在处理一些照片资产,我正在尝试浏览我的相机胶卷并打印出每张照片中的所有资产。我知道它需要是一个 for 循环,但只是不完全确定如何编写它

guard let selectedIndexPath = collectionView.indexPathsForSelectedItems?.first else { return nil }

0 投票
1 回答
82 浏览

ios - Swift 包中的 UI 元素

我遇到了一些具体的问题,我真的需要解决:

尝试组装我自己的具有复杂结构的 Swift 包,有一个想法^我可以重用一些设计元素,例如颜色、字体、图像和 UITableViewCell 。课程^我已将我的文件添加到包中^,但我的项目无法编译,因为 Xcode 没有看到我的元素在范围内。所以,这就是问题所在。 在此处输入图像描述

我的包的结构^ 尤其是 xib 文件和 StandartCell.swift - 它们是主要的。

在此处输入图像描述

问题=(

在此处输入图像描述

和我的包裹清单

如您所见-单元配置和单元类的协议是公开的(堆栈问题中的主要原因)-但对我来说它不起作用 在此处输入图像描述

0 投票
0 回答
31 浏览

ios - 生成具有 Cpp 代码或文件的 SDK 框架时未创建 iOS Xcode 12 _CodeSignature 文件夹

我正在尝试在 xCode12 中创建 SDK 框架。我的代码有 cpp 文件、Objective-c 和 .swift 文件

现在,当我尝试生成框架并且我能够构建项目并且它成功构建框架但未生成“_codesignature”文件夹时,因此当我在其他项目中导入此框架时,它会给出导入错误。

如果我删除 .cpp 和 Objective-c 文件,那么我可以使用“_codesignature”文件夹生成框架,并能够成功地将框架导入其他项目。

那么任何人都可以建议为什么.cpp文件在生成框架时不允许创建“_codesignature”文件夹。