gpt4 book ai didi

ios - 在 Watch App 中访问一类 iPhone 应用

转载 作者:搜寻专家 更新时间:2023-11-01 07:22:06 26 4
gpt4 key购买 nike

我想在 watch 应用程序中使用我已经开发的 NSObject 类( watch 应用程序目标已添加到同一项目)。

我的 iPhone 应用程序是用 Objective-C 编写的,现在我使用 Swift 作为 Watch Extension,所以我创建了一个 Bridge-Header 来在 Watch App 中使用这个类并将这个类添加到 Watch Extension目标。当我构建应用程序时,由于以下原因,它给了我许多来自其他类的错误:

Cannot find interface declaration for UIControllerView, SuperClass of xxxxClass

所有这些错误文件似乎都以 WatchKit Extension 为目标,但我没有包含它们。在这些文件中,Target Membership Watch Extension 也未选中(意味着不是扩展的目标)。以下是我没有添加到 Watch Extension 中的类,但它们作为 Watch Extension 类运行。

enter image description here

最佳答案

您需要选择该类并从文件检查器检查 WatchKit 扩展的目标成员资格。

对于 Swift 类:

enter image description here

对于 Objective-C 类,你为 .m 文件制作它

关于ios - 在 Watch App 中访问一类 iPhone 应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38322051/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com